Class prob_dens_mdim_gmm (o2scl)

O2scl : Class List

template<class gauss_vec_t = boost::numeric::ublas::vector<double>, class gauss_mat_t = boost::numeric::ublas::matrix<double>>
class prob_dens_mdim_gmm : public o2scl::prob_dens_mdim<boost::numeric::ublas::vector<double>>

A probability density distribution from a Gaussian mixture model.

Public Types

typedef boost::numeric::ublas::vector<double> internal_vec_t

Public Functions

inline prob_dens_mdim_gmm()
inline prob_dens_mdim_gmm(const prob_dens_mdim_gmm &pdmg_loc)

Copy constructor.

inline prob_dens_mdim_gmm &operator=(const prob_dens_mdim_gmm &pdmg_loc)

Copy constructor with operator=.

inline void clear()

Clear the distribution.

inline size_t get_n_components()

Return the number of Gaussians, or 0 if the object is empty.

inline virtual int read_generic(std::istream &fin)

Read the Gaussian mixture from an input file.

inline virtual int write_generic(std::ostream &fout)

Write the Gaussian mixture to an output file.

inline virtual void operator()(gauss_vec_t &x) const

Sample the distribution.

inline virtual size_t dim() const

Return the dimensionality.

inline virtual double pdf(const gauss_vec_t &x) const

Compute the normalized probability density.

inline virtual double log_pdf(const gauss_vec_t &x) const

The log of the normalized density.

Public Members

rng r2

Base random number generator.

This is used to automatically generate initial means for the Gaussians if a user-specified guess is not provided.

std::vector<o2scl::prob_dens_mdim_gaussian<gauss_vec_t, gauss_mat_t>> pdmg

The Gaussians.

internal_vec_t weights

The weights (must add to 1)

int verbose

Verbosity parameter.