IT++
4.3.1
Toggle main menu visibility
itpp
stat
mog_diag.h
Go to the documentation of this file.
1
28
29
#ifndef MOG_DIAG_H
30
#define MOG_DIAG_H
31
32
#include <
itpp/stat/mog_generic.h
>
33
#include <itpp/itexports.h>
34
35
36
namespace
itpp
37
{
38
55
class
ITPP_EXPORT
MOG_diag
:
public
MOG_generic
56
{
57
58
public
:
59
65
MOG_diag
() {
zero_all_ptrs
();
init
(); }
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
105
~MOG_diag
() {
cleanup
(); }
106
111
void
cleanup
() {
free_all_ptrs
();
MOG_generic::cleanup
(); }
112
118
void
load(
const
std::string &name_in);
119
121
void
convert_to_full
() {};
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
147
protected
:
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
203
double
**
c_diag_covs_inv_etc
;
204
206
double
*
c_weights
;
207
209
double
*
c_log_weights
;
210
212
double
*
c_log_det_etc
;
213
214
private
:
215
216
vec tmpvecK;
217
double
* c_tmpvecK;
218
219
};
220
221
}
222
223
#endif
// #ifndef MOG_DIAG_H
224
itpp::Array
General array class.
Definition
array.h:105
itpp::MOG_diag::~MOG_diag
~MOG_diag()
Default destructor.
Definition
mog_diag.h:105
itpp::MOG_diag::MOG_diag
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
itpp::MOG_diag::MOG_diag
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
itpp::MOG_diag::MOG_diag
MOG_diag()
Default constructor.
Definition
mog_diag.h:65
itpp::MOG_diag::MOG_diag
MOG_diag(Array< vec > &means_in, bool)
Construct a model using user supplied mean vectors.
Definition
mog_diag.h:85
itpp::MOG_diag::c_diag_covs_inv_etc
double ** c_diag_covs_inv_etc
pointers to the inverted covariance vectors
Definition
mog_diag.h:203
itpp::MOG_diag::load
void load(const std::string &name_in)
Initialise the model by loading the parameters from a model file.
Definition
mog_diag.cpp:277
itpp::MOG_diag::MOG_diag
MOG_diag(const std::string &name)
Construct the MOG_diag object by loading the parameters from a model file.
Definition
mog_diag.h:70
itpp::MOG_diag::convert_to_full
void convert_to_full()
Do nothing. Present for compatability with the MOG_generic class.
Definition
mog_diag.h:121
itpp::MOG_diag::zero_all_ptrs
void zero_all_ptrs()
ADD DOCUMENTATION HERE.
Definition
mog_diag.cpp:207
itpp::MOG_diag::c_means
double ** c_means
pointers to the mean vectors
Definition
mog_diag.h:197
itpp::MOG_diag::cleanup
void cleanup()
Release memory used by the model. The model will be empty.
Definition
mog_diag.h:111
itpp::MOG_diag::c_log_det_etc
double * c_log_det_etc
pointer to the log_det_etc vector
Definition
mog_diag.h:212
itpp::MOG_diag::MOG_diag
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
itpp::MOG_diag::c_log_weights
double * c_log_weights
pointer to the log version of the weight vector
Definition
mog_diag.h:209
itpp::MOG_diag::free_all_ptrs
void free_all_ptrs()
ADD DOCUMENTATION HERE.
Definition
mog_diag.cpp:219
itpp::MOG_diag::c_weights
double * c_weights
pointer to the weight vector
Definition
mog_diag.h:206
itpp::MOG_diag::c_diag_covs
double ** c_diag_covs
pointers to the covariance vectors
Definition
mog_diag.h:200
itpp::MOG_generic::cleanup
virtual void cleanup()
Release memory used by the model. The model will be empty.
Definition
mog_generic.cpp:329
itpp::MOG_generic::init
void init()
Initialise the model to be empty.
Definition
mog_generic.cpp:43
itpp::MOG_generic::convert_to_diag
virtual void convert_to_diag()
Convert the model to use diagonal covariances.
Definition
mog_generic.cpp:499
itpp::MOG_generic::MOG_generic
MOG_generic()
Default constructor.
Definition
mog_generic.h:67
mog_generic.h
Generic Mixture of Gaussians (MOG) class - header file.
itpp
itpp namespace
Definition
itmex.h:37
Generated by
1.17.0