Class exp_max_gmm (o2scl)

O2scl : Class List

template<class data_mat_t = const_matrix_view_table<>, class gauss_vec_t = boost::numeric::ublas::vector<double>, class gauss_mat_t = boost::numeric::ublas::matrix<double>>
class exp_max_gmm

Expectation maximization for a Gaussian mixture model.

(very experimental and not working yet)

Compute the Gaussian mixture model

size_t np

The number of points.

size_t nd_in

The number of dimensions of the inputs.

data_mat_t data

The copy of the data.

bool data_set

True if the data has been specified.

internal_mat_t resps

The responsibilities.

inline int calc_auto(size_t n_gauss)

Compute the Gaussian mixture model using random guesses based on the data.

template<class vec_t, class mat2_t, class ten_t>
inline int calc_guess(size_t n_gauss, vec_t &wgts, mat2_t &means, ten_t &covars)

Compute the Gaussian mixture model using the specified initial pdmg.weights, means, and covariance matrices.

Public Functions

inline const prob_dens_mdim_gmm &get_gmm()

Get the underlying Gaussian mixture probability density.

inline exp_max_gmm()
inline void set_data(size_t n_in, size_t n_points, data_mat_t &dat)

Initialize the data The object vecs should be a matrix with a first index of size n_in and a second index of size n_points. It may have be any type which allows the use of operator(,) and std::swap.

inline void get_data(size_t &n_in, size_t &n_points, data_mat_t &dat)

Get the data used for interpolation.

Public Members

bool err_nonconv

If true, call the error handler if the calculation fails.

int verbose

Verbosity parameter (default 0)

int ntrial

Maximum number of iterations.

double tol_rel

Relative tolerance (default \( 10^[-6} \))

double tol_abs

Absolute tolerance (default \( 0 \))

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.

Protected Types

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

Protected Functions

inline int calc_internal(size_t n_gauss = 1)

Use the expectation-maximization algorithm to optimize the Gaussian mixture.

Protected Attributes

prob_dens_mdim_gmm<gauss_vec_t, gauss_mat_t> pdmg

The underlying Gaussian mixture probability density.