mlpy.stats.models.mixture.GMM

class mlpy.stats.models.mixture.GMM(ncomponents=1, prior=None, mix_prior=None, mix_weight=None, mean=None, cov=None, n_iter=None, thresh=None, verbose=None)[source]

Bases: mlpy.stats.models.mixture.MixtureModel

Gaussian mixture model class.

Representation of a gaussian mixture model probability distribution. This class allows for easy evaluation of, sampling from, and maximum-likelihood estimation of the parameters of a distribution.

Parameters:

ncomponents : int, optional

Number of mixture components. Default is 1.

prior : normal_invwishart, optional

A normal_invwishart distribution.

mix_prior : float or array_like, shape (ncomponents,), optional

Prior mixture probabilities.

mix_weight : array_like, shape (ncomponents,), optional

Mixture weights.

mean : array, shape (ncomponents, nfeatures)

Mean parameters for each state.

cov : array, shape (ncomponents, nfeatures, nfeatures)

Covariance parameters for each state.

n_iter : int, optional

Number of EM iterations to perform. Default is 100.

thresh : float, optional

Convergence threshold. EM iterations will stop when average gain in log-likelihood is below this threshold. Default is 1e-4.

verbose : bool, optional

Controls if debug information is printed to the console. Default is False.

Examples

>>> from mlpy.stats.models.mixture import GMM
>>> m = GMM()

Note

Adapted from Matlab:

Copyright (2010) Kevin Murphy and Matt Dunham
License: MIT

Attributes

mean Mean parameters of the emission.
cov Covariance parameters of the emission.
ncomponents (int) Number of mixture components.
dim (int) Dimensionality of the each component.
prior (normal_invwishart) A normal_invwishart distribution.
mix_prior (array_like, shape (ncomponents,)) Prior mixture probabilities.
mix_weight (array_like, shape (ncomponents,)) Mixture weights.
cond_proba (conditional_normal) A conditional_normal probability distribution.
n_iter (int) Number of EM iterations to perform.
thresh (float) Convergence threshold.
verbose (bool) Controls if debug information is printed to the console.

Methods

fit(x[, n_init]) Fit the mixture model from the data x.
predict(x) Predict label for data.
predict_proba(x) Predict posterior probability of data under the model.
sample([size]) Generate random samples from the model.
score(x[, y]) Compute the log probability under the model.
score_samples(x) Return the per-sample likelihood of the data under the model.