35#include <itpp/itexports.h>
79 MOG_generic(
const int &K_in,
const int &D_in,
bool full_in =
false) {
init(K_in, D_in, full_in); }
120 void init(
const int &K_in,
const int &D_in,
bool full_in =
false);
129 void init(
Array<vec> &means_in,
bool full_in =
false);
151 virtual void cleanup();
195 void set_weights(vec &weights_in);
198 void set_means_zero();
201 void set_diag_covs_unity();
204 void set_full_covs_unity();
207 void set_weights_uniform();
224 virtual void load(
const std::string &name_in);
229 virtual void save(
const std::string &name_in)
const;
256 virtual void convert_to_diag();
263 virtual void convert_to_full();
266 virtual double log_lhood_single_gaus(
const vec &x_in,
const int k);
269 virtual double log_lhood(
const vec &x_in);
272 virtual double lhood(
const vec &x_in);
275 virtual double avg_log_lhood(
const Array<vec> &X_in);
Definition of Array class (container)
Import/Export definitions for some templates defined in base folder.
Generic Mixture of Gaussians (MOG) class. Used as a base for other MOG classes.
void convert_to_diag_internal()
ADD DOCUMENTATION HERE.
Array< mat > full_covs_inv
Pre-calcuated inverted version of each full covariance matrix.
virtual void setup_weights()
additional processing of the weight vector, done as the last step of weight initialisation
void set_checks(bool do_checks_in)
Enable/disable internal checks for likelihood functions.
void set_diag_covs_internal(Array< vec > &diag_covs_in)
ADD DOCUMENTATION HERE.
bool check_size(const vec &x_in) const
Check if vector x_in has the same dimensionality as the model.
Array< mat > full_covs
full covariance matrices
void set_weights_uniform_internal()
ADD DOCUMENTATION HERE.
virtual void cleanup()
Release memory used by the model. The model will be empty.
int get_K() const
Return the number of Gaussians.
bool check_array_uniformity(const Array< vec > &A) const
Check if all vectors in Array X_in have the same dimensionality.
void init()
Initialise the model to be empty.
MOG_generic(Array< vec > &means_in, Array< vec > &diag_covs_in, vec &weights_in)
Construct a model using user supplied parameters (diagonal covariance version)
Array< vec > get_means() const
Obtain a copy of the array of mean vectors.
MOG_generic(const std::string &name_in)
Construct the MOG_generic object by loading the parameters from a model file.
void set_weights_internal(vec &_weigths)
ADD DOCUMENTATION HERE.
MOG_generic(Array< vec > &means_in, bool full_in=false)
Construct a model using user supplied mean vectors.
void set_full_covs_internal(Array< mat > &full_covs_in)
ADD DOCUMENTATION HERE.
bool do_checks
indicates whether checks on input data are done
virtual void setup_covs()
additional processing of covariance vectors/matrices, done as the last step of covariance initialisat...
Array< vec > get_diag_covs() const
Obtain a copy of the array of diagonal covariance vectors.
vec get_weights() const
Obtain a copy of the weight vector.
int get_D() const
Return the dimensionality.
void convert_to_full_internal()
ADD DOCUMENTATION HERE.
virtual void setup_means()
additional processing of mean vectors, done as the last step of mean initialisation
virtual void setup_misc()
additional processing of miscellaneous parameters, done as the last step of overall initialisation
MOG_generic(Array< vec > &means_in, Array< mat > &full_covs_in, vec &weights_in)
Construct a model using user supplied parameters (full covariance version)
MOG_generic(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)
bool valid
indicates whether the parameters are valid
void set_means_internal(Array< vec > &means_in)
ADD DOCUMENTATION HERE.
virtual double log_lhood_internal(const vec &x_in)
ADD DOCUMENTATION HERE.
Array< vec > diag_covs
diagonal covariance matrices, stored as vectors
void set_full_covs_unity_internal()
ADD DOCUMENTATION HERE.
virtual double lhood_internal(const vec &x_in)
ADD DOCUMENTATION HERE.
bool is_valid() const
Returns true if the model's parameters are valid.
virtual double log_lhood_single_gaus_internal(const vec &x_in, const int k)
ADD DOCUMENTATION HERE.
bool is_full() const
Returns true if the model has full covariance matrices.
Array< vec > diag_covs_inv_etc
Pre-calcuated inverted version of each diagonal covariance vector, where the covariance elements are ...
vec log_weights
Pre-calculated log versions of the weights.
vec log_det_etc
Gaussian specific pre-calcualted constants.
void set_diag_covs_unity_internal()
ADD DOCUMENTATION HERE.
void set_means_zero_internal()
ADD DOCUMENTATION HERE.
bool full
indicates whether we are using full or diagonal covariance matrices
MOG_generic()
Default constructor.
virtual ~MOG_generic()
Default destructor.
double log_max_K
Pre-calcualted std::log(std::numeric_limits<double>::max() / K), where K is the number of Gaussians.
virtual void load(const std::string &name_in)
Initialise the model by loading the parameters from a model file.
void set_paranoid(bool paranoid_in)
Enable/disable paranoia about numerical stability.
Array< mat > get_full_covs() const
Obtain a copy of the array of full covariance matrices.
bool paranoid
indicates whether we are paranoid about numerical stability
Matrix Class Definitions.
Templated Vector Class Definitions.