IT++ Logo

mog_diag_kmeans.h

Go to the documentation of this file.
00001 
00031 #ifndef MOG_DIAG_KMEANS_H
00032 #define MOG_DIAG_KMEANS_H
00033 
00034 #include <itpp/stat/mog_diag.h>
00035 
00036 
00037 namespace itpp {
00038 
00043   class MOG_diag_kmeans_sup : public MOG_diag {
00044 
00045     public:
00047     MOG_diag_kmeans_sup() { verbose = false; }
00048 
00050     ~MOG_diag_kmeans_sup() { }
00051 
00053     void run(MOG_diag &model_in, Array<vec> &X_in, int max_iter_in=10, double trust_in=0.5, bool normalise_in=true, bool verbose_in=false);
00054 
00055     protected:
00056 
00058     inline double dist(const double * x, const double * y) const;
00060     void assign_to_means();
00062     void recalculate_means();
00064     bool dezombify_means();
00066     double measure_change() const;
00068     void initial_means();
00070     void iterate();
00072     void calc_means();
00074     void calc_covs();
00076     void calc_weights();
00078     void normalise_vectors();
00080     void unnormalise_vectors();
00082     void unnormalise_means();
00083 
00085     int max_iter;
00086 
00090     double trust;
00091 
00093     bool verbose;
00094 
00096     int N;
00097 
00099     double ** c_X;
00100 
00102     Array<vec> means_old;
00103 
00105     double ** c_means_old;
00106 
00108     Array<ivec> partitions;
00109 
00111     int ** c_partitions;
00112 
00114     ivec count;
00115 
00117     int * c_count;
00118 
00119     private:
00120 
00121     vec norm_mu;
00122     double * c_norm_mu;
00123 
00124     vec norm_sd;
00125     double * c_norm_sd;
00126 
00127     vec tmpvec;
00128     double * c_tmpvec;
00129 
00130 
00131   };
00132 
00133   //
00134   // convenience functions
00135 
00169   void MOG_diag_kmeans(MOG_diag &model_in, Array<vec> &X_in, int max_iter_in=10, double trust_in=0.5, bool normalise_in=true, bool verbose_in=false);
00170 
00171 }
00172 
00173 #endif  // #ifndef MOG_DIAG_KMEANS_H
00174 
SourceForge Logo

Generated on Sat Apr 19 10:57:52 2008 for IT++ by Doxygen 1.5.5