• API Main Page
  • Documentation
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

src/som.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008/2009 by Matthias Ihrke                                  *
00003  *   mihrke@uni-goettingen.de                                              *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
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      - Self-Organizing Maps (SOM)
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 /* SOM_H */

Generated on Fri Jun 25 2010 14:10:21 for libeegtools by  doxygen 1.7.0