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
00063 static unsigned lambda;
00064 static double minimal_deletion_age;
00065 static double deletion_threshold;
00066 static double deletion_threshold_lq;
00067
00068
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
00082 static double helper_T_short;
00083 static double helper_T_long;
00084 static double helper_T_youth;
00085 static double helper_T_insertion_threshold;
00087
00088
00089
00090
00091
00092
00093
00094
00101 GNG(classifierparams ¶ms);
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
00122
00123
00124
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();
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