IT++ Logo
mog_diag_kmeans.h
Go to the documentation of this file.
1 
30 #ifndef MOG_DIAG_KMEANS_H
31 #define MOG_DIAG_KMEANS_H
32 
33 #include <itpp/stat/mog_diag.h>
34 #include <itpp/itexports.h>
35 #include <itpp/base/base_exports.h>
36 
37 namespace itpp
38 {
39 
44 class ITPP_EXPORT MOG_diag_kmeans_sup : public MOG_diag
45 {
46 
47 public:
49  MOG_diag_kmeans_sup() { verbose = false; }
50 
53 
55  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);
56 
57 protected:
58 
60  inline double dist(const double * x, const double * y) const;
62  void assign_to_means();
64  void recalculate_means();
66  bool dezombify_means();
68  double measure_change() const;
70  void initial_means();
72  void iterate();
74  void calc_means();
76  void calc_covs();
78  void calc_weights();
80  void normalise_vectors();
82  void unnormalise_vectors();
84  void unnormalise_means();
85 
87  int max_iter;
88 
92  double trust;
93 
95  bool verbose;
96 
98  int N;
99 
101  double ** c_X;
102 
105 
107  double ** c_means_old;
108 
111 
113  int ** c_partitions;
114 
116  ivec count;
117 
119  int * c_count;
120 
121 private:
122 
123  vec norm_mu;
124  double * c_norm_mu;
125 
126  vec norm_sd;
127  double * c_norm_sd;
128 
129  vec tmpvec;
130  double * c_tmpvec;
131 
132 
133 };
134 
135 //
136 // convenience functions
137 
171 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);
172 
173 }
174 
175 #endif // #ifndef MOG_DIAG_KMEANS_H
176 
SourceForge Logo

Generated on Sat May 25 2013 16:32:24 for IT++ by Doxygen 1.8.2