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

Bases: mlpy.optimize.algorithms.EM

Mixture model base class.

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


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.

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.


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


Adapted from Matlab:

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


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 (cond_rv_frozen) Conditional 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.


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.