00001 #ifndef Som_H 00002 #define Som_H 00003 00004 #include <math.h> 00005 #include <iostream> 00006 #include "defs.h" 00007 #include "util.h" 00008 #include "eigensystems.h" 00009 #include "NetParams.h" 00010 #include "LearningFactory.h" 00011 00012 00022 class SOM { 00023 public: 00025 SOM( NetParams n ); 00026 00028 SOM(); 00029 00031 ~SOM(); 00032 00033 NetParams netParams; 00034 00035 LearningAlgorithm * getLearningAlgorithm(); 00036 00037 protected: 00038 Value_Type _quantization_error; 00039 Value_Type _topological_error; 00040 void setQuantizationError( Value_Type q ); 00041 void setTopologicalError( Value_Type t ); 00042 LearningAlgorithm * _learningAlgorithm; 00043 void RandomInit(); 00044 void LinearInit(); 00045 00046 00047 00048 public: 00050 void Quality(); 00051 00053 int AutomaticParametrization(); 00054 00056 void Learning(); 00057 00058 00059 int EECNI( int fi ); 00060 00062 void InitMapcode(); 00063 00065 Value_Type getQuantizationError(); 00066 00068 Value_Type getTopologicalError(); 00069 00071 void Labeling(); 00072 00073 00075 void setParams( NetParams n ); 00076 00078 void setMapcode( Mapcode * mapcode ); 00079 00081 void setData( SOMData * data ); 00082 00084 void setDelta( TMatrix delta ); 00085 00087 TMatrix getDelta() const; 00088 00090 Mapcode * getMapcode() const; 00091 00093 SOMData * getData() const; 00094 00096 int getNumIterations(); 00097 00099 void setNumIterations( int i ); 00100 00102 int getInitType(); 00103 00105 void setInitType( int init ); 00106 00108 Value_Type getInitLearningRate(); 00109 00111 void setInitLearningRate( Value_Type init_rate ); 00112 00114 Value_Type getInitNeighbor(); 00115 00117 void setInitNeighbor( Value_Type init_neighbor ); 00118 00120 int getLearningType(); 00121 00123 void setLearningType( int t ); 00124 00126 void setLearnType( string str ); 00127 00129 string getLearnType(); 00130 00131 Value_Type getEigenValue( int index, int d, int n, TMatrix entries ); 00132 00134 vector<int> getNeighbors( int i ); 00135 00136 private: 00137 TVector eigenvalue; 00138 00139 }; 00140 00141 00142 00143 #endif