Class to represent a self_organizing_map
Constructor for self_organizing_map
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(self_organizing_map) | :: | kohonen_map |
A |
|||
type(kohonen_layer_parameters), | dimension(:) | :: | training_parameters |
A |
Destructor for self_organizing_map
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(self_organizing_map) | :: | kohonen_map |
A |
Training function for self_organizing_map
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(self_organizing_map) | :: | kohonen_map |
A |
|||
type(kohonen_pattern), | intent(inout), | dimension(:) | :: | input_data |
A |
Function for Prediction of a self_organizing_map
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(self_organizing_map) | :: | kohonen_map |
A |
|||
type(kohonen_pattern), | intent(inout), | dimension(:) | :: | input_data |
A |
|
integer, | intent(out), | dimension(:,:) | :: | map_output |
An integer array with the map output |
Print function for self_organizing_map
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(self_organizing_map) | :: | kohonen_map | ||||
integer, | intent(inout), | optional | :: | unit_ |
Subroutine to read the prototypes to define a self_organizing_map
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(self_organizing_map) | :: | kohonen_map |
A |
|||
character(len=*) | :: | som_fl |
A character variable with the name of the file |
Function to get count matrix for self_organizing_map
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(self_organizing_map) | :: | kohonen_map | ||||
integer, | intent(inout), | dimension(:,:,:) | :: | count_ |
Function to find the input samples associated with specific vector
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(self_organizing_map) | :: | kohonen_map | ||||
real(kind=wp), | intent(inout), | dimension(:,:) | :: | input_pattern | ||
integer, | allocatable | :: | sample_index(:) |
Subroutine to get SOM prototypes
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(self_organizing_map) | :: | kohonen_map |
A |
|||
real(kind=wp), | intent(out), | dimension(:,:) | :: | prototypes |
A real array to return the values of the SOM prototypes |
Subroutine to get the u_matrix from a SOM
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(self_organizing_map) | :: | kohonen_map |
A |
|||
real(kind=wp), | intent(out), | dimension(:,:,:) | :: | u_matrix |
A real array to return the u_matrix |
Subroutine to connect the self_organizing_map module to R o C Import section
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=c_double), | intent(in) | :: | x(npat,nvar) |
Real array with the input patterns |
||
integer(kind=c_int), | intent(in) | :: | nvar |
Integer variables to indicate the number of variables and patterns |
||
integer(kind=c_int), | intent(in) | :: | npat |
Integer variables to indicate the number of variables and patterns |
||
integer(kind=c_int), | intent(in) | :: | nx |
Integer variables to indicate the number of nodes of the SOM |
||
integer(kind=c_int), | intent(in) | :: | ny |
Integer variables to indicate the number of nodes of the SOM |
||
integer(kind=c_int), | intent(in) | :: | nepoch |
Integer variables to indicate the number of epochs for training |
||
real(kind=c_double), | intent(in) | :: | alpha |
Real value with the initial learning rate |
||
integer(kind=c_int), | intent(in) | :: | grid_type |
Integer variable to indicate the type of grid |
||
integer(kind=c_int), | intent(in) | :: | distance_type |
Integer variable to indicate the distance type |
||
integer(kind=c_int), | intent(in) | :: | neigh_type |
Integer variable to indicate the neighborhood type |
||
integer(kind=c_int), | intent(in) | :: | toroidal |
Integer variable to indicate if a toroidal grid is used |
||
real(kind=c_double), | intent(out) | :: | prot(nx*ny,nvar) |
Real array for the prototypes |
||
real(kind=c_double), | intent(out) | :: | distortion(nepoch) |
Real array for the distortion measure (error during training) |
||
real(kind=c_double), | intent(out) | :: | u_matrix(2*nx-1,2*ny-1) |
Real array for the u_matrix |
||
real(kind=c_double), | intent(out) | :: | coords(nx*ny,3) |
Real array for the grid coordinates of the SOM |
||
integer(kind=c_int), | intent(out) | :: | number_patterns(nx,ny) |
Integer array with the number of hits for each neuron |
||
integer(kind=c_int), | intent(out) | :: | node_index(npat,3) |
Integer array with the index node for all the neurons of the SOM |
Subroutine to connect this module to R
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=c_double), | intent(in) | :: | prot(nx*ny,nvar) | |||
integer(kind=c_int), | intent(in) | :: | nx | |||
integer(kind=c_int), | intent(in) | :: | ny | |||
real(kind=c_double), | intent(in) | :: | new_pat(npat,nvar) | |||
integer(kind=c_int), | intent(in) | :: | npat | |||
integer(kind=c_int), | intent(in) | :: | nvar | |||
integer(kind=c_int), | intent(out) | :: | node_index(npat,3) |
type,extends(kohonen_map_base) :: self_organizing_map !! Class to represent a self_organizing_map private character(len=NUMCHAR) :: class_name='self_organizing_map'; type(kohonen_prototype),allocatable :: grid(:,:,:) integer,allocatable :: number_patterns(:,:,:),cells_index(:,:) real(kind=wp),allocatable :: u_matrix(:,:,:),distance(:,:) real(kind=wp),allocatable :: cells_distances(:,:),coordinates(:,:) type(kohonen_layer_parameters) :: parameters type(factory_distance) :: factory class(distance_base),allocatable :: distance_function real(kind=wp),allocatable :: distortion(:) type(rkiss05_generator) :: rnumber_grator integer :: seed integer,allocatable :: grid_pattern_index(:,:,:),list_node_grid(:,:,:,:) contains procedure,public :: create => create_som procedure,public :: destroy => destroy_som procedure,private :: create_random_sample procedure,private :: train_som_data procedure,public :: train => train_som_data procedure,public :: predict => predict_som procedure,public :: print => print_som procedure,public :: read => read_som procedure,public :: get_count => get_count_som procedure,public :: query => query_som procedure,public :: get_prototypes !procedure,public :: get_index => get_index_som procedure,public :: get_u_matrix => get_u_matrix_som procedure,private :: find_best_match_unit procedure,private :: update_weights !procedure,private :: update_weights1 procedure,private :: find_bmu_grid procedure,private :: calculate_u_matrix procedure,private :: calculate_u_matrix_hexagonal procedure,private :: calculate_u_matrix_rectangular procedure,private :: calculate_sigma procedure,nopass,private :: position2index procedure,nopass,private :: index2position procedure,nopass,private :: calculate_distance_matrix procedure,nopass,private :: calculate_coordinates procedure,private :: calculate_distance_between_prototypes procedure,nopass,public :: external_train_map procedure,nopass,public :: external_predict_map ! end type self_organizing_map