mlpy.stats.models.mixture.DiscreteMM¶
-
class
mlpy.stats.models.mixture.
DiscreteMM
(ncomponents=1, prior=None, mix_prior=None, mix_weight=None, transmat=None, alpha=None, n_iter=None, thresh=None, verbose=None)[source]¶ Bases:
mlpy.stats.models.mixture.MixtureModel
Discrete mixture model class.
Representation of a discrete 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.
transmat : array_like, shape (ncomponents, ncomponents), optional
Matrix of transition probabilities between states.
alpha : float
Value of Dirichlet prior on observations. Default is 1.1 (1=MLE)
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 DiscreteMM
>>> m = DiscreteMM()
Attributes
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. transmat (array_like, shape (ncomponents, ncomponents)) Matrix of transition probabilities between states. alpha (float) Value of Dirichlet prior on observations. 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. 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.