mog_diag.h
Go to the documentation of this file.
#ifndef MOG_DIAG_H
#define MOG_DIAG_H
#include <itpp/stat/mog_generic.h>
#include <itpp/itexports.h>
namespace itpp
{
class ITPP_EXPORT MOG_diag : public MOG_generic
{
public:
MOG_diag() { zero_all_ptrs(); init(); }
MOG_diag(const std::string &name) { zero_all_ptrs(); load(name); }
MOG_diag(const int &K_in, const int &D_in, bool full_in = false) { zero_all_ptrs(); init(K_in, D_in, full_in); }
MOG_diag(Array<vec> &means_in, bool) { zero_all_ptrs(); init(means_in, false); }
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); }
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(); }
~MOG_diag() { cleanup(); }
void cleanup() { free_all_ptrs(); MOG_generic::cleanup(); }
void load(const std::string &name_in);
void convert_to_full() {};
double log_lhood_single_gaus(const double * c_x_in, const int k) const;
double log_lhood_single_gaus(const vec &x_in, const int k) const;
double log_lhood(const double * c_x_in);
double log_lhood(const vec &x_in);
double lhood(const double * c_x_in);
double lhood(const vec &x_in);
double avg_log_lhood(const double ** c_x_in, int N);
double avg_log_lhood(const Array<vec> & X_in);
protected:
void setup_means();
void setup_covs();
void setup_weights();
void setup_misc();
double log_lhood_single_gaus_internal(const double * c_x_in, const int k) const;
double log_lhood_single_gaus_internal(const vec &x_in, const int k) const;
double log_lhood_internal(const double * c_x_in);
double log_lhood_internal(const vec &x_in);
double lhood_internal(const double * c_x_in);
double lhood_internal(const vec &x_in);
double ** enable_c_access(Array<vec> & A_in);
int ** enable_c_access(Array<ivec> & A_in);
double * enable_c_access(vec & v_in);
int * enable_c_access(ivec & v_in);
double ** disable_c_access(double ** A_in);
int ** disable_c_access(int ** A_in);
double * disable_c_access(double * v_in);
int * disable_c_access(int * v_in);
void zero_all_ptrs();
void free_all_ptrs();
double ** c_means;
double ** c_diag_covs;
double ** c_diag_covs_inv_etc;
double * c_weights;
double * c_log_weights;
double * c_log_det_etc;
private:
vec tmpvecK;
double * c_tmpvecK;
};
}
#endif // #ifndef MOG_DIAG_H
itpp::Array
General array class.
Definition array.h:105
itpp::MOG_diag
Diagonal Mixture of Gaussians (MOG) class.
Definition mog_diag.h:56
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::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::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::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
Generic Mixture of Gaussians (MOG) class. Used as a base for other MOG classes.
Definition mog_generic.h:58
itpp::MOG_generic::cleanup
virtual void cleanup()
Release memory used by the model. The model will be empty.
Definition mog_generic.cpp:329
mog_generic.h
Generic Mixture of Gaussians (MOG) class - header file.
itpp
itpp namespace
Definition itmex.h:37

Generated on Mon Jun 10 2024 11:49:25 for IT++ by Doxygen 1.9.8