IT++ Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
35 
36 namespace itpp
37 {
38 
44 {
45 
46 public:
49 
52 
54  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);
55 
56 protected:
57 
59  inline double dist(const double * x, const double * y) const;
61  void assign_to_means();
63  void recalculate_means();
65  bool dezombify_means();
67  double measure_change() const;
69  void initial_means();
71  void iterate();
73  void calc_means();
75  void calc_covs();
77  void calc_weights();
79  void normalise_vectors();
81  void unnormalise_vectors();
83  void unnormalise_means();
84 
86  int max_iter;
87 
91  double trust;
92 
94  bool verbose;
95 
97  int N;
98 
100  double ** c_X;
101 
104 
106  double ** c_means_old;
107 
110 
112  int ** c_partitions;
113 
115  ivec count;
116 
118  int * c_count;
119 
120 private:
121 
122  vec norm_mu;
123  double * c_norm_mu;
124 
125  vec norm_sd;
126  double * c_norm_sd;
127 
128  vec tmpvec;
129  double * c_tmpvec;
130 
131 
132 };
133 
134 //
135 // convenience functions
136 
170 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);
171 
172 }
173 
174 #endif // #ifndef MOG_DIAG_KMEANS_H
175 
SourceForge Logo

Generated on Fri Mar 21 2014 17:14:14 for IT++ by Doxygen 1.8.1.2