GNG.h

Go to the documentation of this file.
00001 
00024 #ifndef _GNG_H
00025 #define _GNG_H
00026 
00027 #include "../Classifier.h"
00028 #include "Unit.h"
00029 
00033 struct meta_cluster {
00035 
00036         unsigned int cluster_id;
00037         list<Unit*> units;
00038         unsigned int winner_hits;
00040 };
00041 
00045 typedef list<meta_cluster> meta_cluster_list;
00046 
00054 class CLASSIFIER_EXPORT_CLASS GNG : public ClassifierAlgorithm
00055 {
00056         public:
00058 
00062                 // these are needed in the GNG class
00063                 static unsigned lambda;          
00064                 static double minimal_deletion_age;  
00065                 static double deletion_threshold;    
00066                 static double deletion_threshold_lq; 
00067 
00068                 // these are only needed in the Unit class, but defined here for consistency
00069                 static unsigned long edge_age_max;   
00070                 static double T_short;               
00071                 static double T_long;                
00072                 static double T_youth;               
00073                 static double T_insert_threshold;
00074                 static double adaptation_threshold;
00075                 static double insertion_tolerance;
00076                 static double lr_winner;             
00077                 static double lr_neighbor;           
00078                 static double minimum_lr;            
00079                 static double lr_insert_threshold;   
00080 
00081                 // these helper functions are used for better performance
00082                 static double helper_T_short;              // helper variable for decreasing short term error, defined es helper_T = e^(-1/T)
00083                 static double helper_T_long;               // helper variable for decreasing long term error, defined es helper_T = e^(-1/T)
00084                 static double helper_T_youth;              // helper variable for decreasing youth, defined es helper_T = e^(-1/T)
00085                 static double helper_T_insertion_threshold;
00087 
00088 
00089                 /*static double e_b(double dist);*/                     /* returns the distance by which the current cluster is moved
00090                                                                 * into the direction of the input sample based on the euclidean
00091                                                                 * distance to it
00092                                                                 */
00093                 //static double e_n(double dist);                       // same as above for direct neighbours
00094 
00101                 GNG(classifierparams &params);
00102 
00104                 virtual ~GNG();
00105 
00115                 virtual void init(FeatureContainer *fc);
00116                 virtual membershiplist getClusterMembership(const featurevector *sample);
00117                 virtual unsigned long nextSample();
00118                 virtual unsigned long nextSample(const featurevector* sample);
00119                 virtual string serialize() const;
00120                 virtual void unserialize(string data);
00121                 //virtual cluster_table* getCluster();
00122                 //virtual connection_table* getConnections();
00123 
00124                 // these are for testing and for quantitative evaluations
00126                 virtual double getWinnerDistance(const featurevector *sample, unsigned int &cluster_id, unsigned int &meta_cluster_id) const;
00128                 virtual unit_list::size_type getNumberNodes() const;
00129 
00130                 virtual meta_cluster_list getMetaClusters(); // the connected meta clusters in the graph
00131 
00132 #if _DEBUG_CLASSIFIERS
00133 
00134                 virtual string toString() const;
00135 #endif
00136 
00137         private:
00138                 const char *algo;
00139 
00146                 FeatureContainer *container;
00147 
00157                 unit_list units;
00158 
00170                 bit_vector feature_mask;
00171 
00180                 const classifierparams params;
00181 
00195                 featurevector maskFeatureVector(const featurevector* sample, bool freeUnused = false) const;
00196 
00197                 void writeToDisk();
00198 };
00199 
00200 #endif

Generated on Mon Jun 5 10:20:42 2006 for Intelligence.kdevelop by  doxygen 1.4.6