Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00088 #ifndef SOM_H
00089 # define SOM_H
00090
00091 #include "definitions.h"
00092 #include "helper.h"
00093 #include "distances.h"
00094
00095 #ifdef __cplusplus
00096 extern "C" {
00097 #endif
00098
00099
00100
00101
00104 struct som_struct;
00105 typedef double(*NeighbourhoodFunction)(int,int,struct som_struct*, int t);
00106
00109 typedef double(*TimeDecayFunction)(int,int,int);
00110
00119 typedef enum {
00120 ONED_LINEAR,
00121 TWOD_GRID,
00122 TWOD_HEXAGONAL,
00123 CUSTOM
00124 } SOMConnectivityType;
00125
00128 typedef struct som_struct {
00129 double **m;
00130 int dimension;
00131 int n;
00132 VectorDistanceFunction distancefct;
00133 void *distancefct_parameters;
00136 int nruns;
00137 int initial_runs;
00140 NeighbourhoodFunction neighbourhoodfct;
00141 TimeDecayFunction time_decay;
00143 SOMConnectivityType connectivity_type;
00144 double **connectivity;
00147 gsl_rng_type *random_number_type;
00148 gsl_rng *rng;
00150 ProgressBarFunction progress;
00151 } Som;
00152
00153 Som* som_init( int dimension, int n, int nruns, SOMConnectivityType connectivity );
00154 void som_free( Som *s );
00155 void som_print( FILE *f, Som *s );
00156
00157 void som_initialize_random( Som *s, double min, double max );
00158 void som_initialize_random_samples( Som *s, double **X, int dim, int nsamples );
00159 double** som_generate_connectivity_matrix( SOMConnectivityType type, double **m, int n );
00160
00161 double som_neighbourhood_gaussian( int x, int bmu, struct som_struct *s, int t);
00162
00163 double som_time_decay_linear( int t, int nruns, int initial_runs );
00164
00165 void som_train_from_data( Som *s, double **X, int dim, int nsamples );
00166
00167 #ifdef __cplusplus
00168 }
00169 #endif
00170
00171 #endif