IT++ 4.3.1
mog_diag.h
Go to the documentation of this file.
1
28
29#ifndef MOG_DIAG_H
30#define MOG_DIAG_H
31
33#include <itpp/itexports.h>
34
35
36namespace itpp
37{
38
55class ITPP_EXPORT MOG_diag : public MOG_generic
56{
57
58public:
59
66
70 MOG_diag(const std::string &name) { zero_all_ptrs(); load(name); }
71
77 MOG_diag(const int &K_in, const int &D_in, bool full_in = false) { zero_all_ptrs(); init(K_in, D_in, full_in); }
78
85 MOG_diag(Array<vec> &means_in, bool) { zero_all_ptrs(); init(means_in, false); }
86
93 MOG_diag(Array<vec> &means_in, Array<vec> &diag_covs_in, vec &weights_in) { zero_all_ptrs(); init(means_in, diag_covs_in, weights_in); }
94
102 MOG_diag(Array<vec> &means_in, Array<mat> &full_covs_in, vec &weights_in) { zero_all_ptrs(); init(means_in, full_covs_in, weights_in); convert_to_diag(); }
103
106
112
118 void load(const std::string &name_in);
119
122
124 double log_lhood_single_gaus(const double * c_x_in, const int k) const;
125
127 double log_lhood_single_gaus(const vec &x_in, const int k) const;
128
130 double log_lhood(const double * c_x_in);
131
133 double log_lhood(const vec &x_in);
134
136 double lhood(const double * c_x_in);
137
139 double lhood(const vec &x_in);
140
142 double avg_log_lhood(const double ** c_x_in, int N);
143
145 double avg_log_lhood(const Array<vec> & X_in);
146
147protected:
148
149 void setup_means();
150 void setup_covs();
151 void setup_weights();
152 void setup_misc();
153
155 double log_lhood_single_gaus_internal(const double * c_x_in, const int k) const;
157 double log_lhood_single_gaus_internal(const vec &x_in, const int k) const;
159 double log_lhood_internal(const double * c_x_in);
161 double log_lhood_internal(const vec &x_in);
163 double lhood_internal(const double * c_x_in);
165 double lhood_internal(const vec &x_in);
166
168 double ** enable_c_access(Array<vec> & A_in);
169
171 int ** enable_c_access(Array<ivec> & A_in);
172
174 double * enable_c_access(vec & v_in);
175
177 int * enable_c_access(ivec & v_in);
178
180 double ** disable_c_access(double ** A_in);
181
183 int ** disable_c_access(int ** A_in);
184
186 double * disable_c_access(double * v_in);
187
189 int * disable_c_access(int * v_in);
190
192 void zero_all_ptrs();
194 void free_all_ptrs();
195
197 double ** c_means;
198
200 double ** c_diag_covs;
201
204
206 double * c_weights;
207
210
213
214private:
215
216 vec tmpvecK;
217 double * c_tmpvecK;
218
219};
220
221}
222
223#endif // #ifndef MOG_DIAG_H
224
General array class.
Definition array.h:105
~MOG_diag()
Default destructor.
Definition mog_diag.h:105
MOG_diag(Array< vec > &means_in, Array< mat > &full_covs_in, vec &weights_in)
Construct a model using user supplied parameters (full covariance version)
Definition mog_diag.h:102
MOG_diag(Array< vec > &means_in, Array< vec > &diag_covs_in, vec &weights_in)
Construct a model using user supplied parameters (diagonal covariance version)
Definition mog_diag.h:93
MOG_diag()
Default constructor.
Definition mog_diag.h:65
MOG_diag(Array< vec > &means_in, bool)
Construct a model using user supplied mean vectors.
Definition mog_diag.h:85
double ** c_diag_covs_inv_etc
pointers to the inverted covariance vectors
Definition mog_diag.h:203
void load(const std::string &name_in)
Initialise the model by loading the parameters from a model file.
Definition mog_diag.cpp:277
MOG_diag(const std::string &name)
Construct the MOG_diag object by loading the parameters from a model file.
Definition mog_diag.h:70
void convert_to_full()
Do nothing. Present for compatability with the MOG_generic class.
Definition mog_diag.h:121
void zero_all_ptrs()
ADD DOCUMENTATION HERE.
Definition mog_diag.cpp:207
double ** c_means
pointers to the mean vectors
Definition mog_diag.h:197
void cleanup()
Release memory used by the model. The model will be empty.
Definition mog_diag.h:111
double * c_log_det_etc
pointer to the log_det_etc vector
Definition mog_diag.h:212
MOG_diag(const int &K_in, const int &D_in, bool full_in=false)
construct a default model (all Gaussians have zero mean and unit variance for all dimensions)
Definition mog_diag.h:77
double * c_log_weights
pointer to the log version of the weight vector
Definition mog_diag.h:209
void free_all_ptrs()
ADD DOCUMENTATION HERE.
Definition mog_diag.cpp:219
double * c_weights
pointer to the weight vector
Definition mog_diag.h:206
double ** c_diag_covs
pointers to the covariance vectors
Definition mog_diag.h:200
virtual void cleanup()
Release memory used by the model. The model will be empty.
void init()
Initialise the model to be empty.
virtual void convert_to_diag()
Convert the model to use diagonal covariances.
MOG_generic()
Default constructor.
Definition mog_generic.h:67
Generic Mixture of Gaussians (MOG) class - header file.
itpp namespace
Definition itmex.h:37