class sklearn.mixture.BayesianGaussianMixture(n_components=1, covariance_type=’full’, tol=0.001, reg_covar=1e06, max_iter=100, n_init=1, init_params=’kmeans’, weight_concentration_prior_type=’dirichlet_process’, weight_concentration_prior=None, mean_precision_prior=None, mean_prior=None, degrees_of_freedom_prior=None, covariance_prior=None, random_state=None, warm_start=False, verbose=0, verbose_interval=10)
[source]
Variational Bayesian estimation of a Gaussian mixture.
This class allows to infer an approximate posterior distribution over the parameters of a Gaussian mixture distribution. The effective number of components can be inferred from the data.
This class implements two types of prior for the weights distribution: a finite mixture model with Dirichlet distribution and an infinite mixture model with the Dirichlet Process. In practice Dirichlet Process inference algorithm is approximated and uses a truncated distribution with a fixed maximum number of components (called the Stickbreaking representation). The number of components actually used almost always depends on the data.
New in version 0.18.
Read more in the User Guide.
Parameters: 


Attributes: 

See also
GaussianMixture
[1]  Bishop, Christopher M. (2006). “Pattern recognition and machine learning”. Vol. 4 No. 4. New York: Springer. 
[2]  Hagai Attias. (2000). “A Variational Bayesian Framework for Graphical Models”. In Advances in Neural Information Processing Systems 12. 
[3]  Blei, David M. and Michael I. Jordan. (2006). “Variational inference for Dirichlet process mixtures”. Bayesian analysis 1.1 
fit (X[, y])  Estimate model parameters with the EM algorithm. 
fit_predict (X[, y])  Estimate model parameters using X and predict the labels for X. 
get_params ([deep])  Get parameters for this estimator. 
predict (X)  Predict the labels for the data samples in X using trained model. 
predict_proba (X)  Predict posterior probability of each component given the data. 
sample ([n_samples])  Generate random samples from the fitted Gaussian distribution. 
score (X[, y])  Compute the persample average loglikelihood of the given data X. 
score_samples (X)  Compute the weighted log probabilities for each sample. 
set_params (**params)  Set the parameters of this estimator. 
__init__(n_components=1, covariance_type=’full’, tol=0.001, reg_covar=1e06, max_iter=100, n_init=1, init_params=’kmeans’, weight_concentration_prior_type=’dirichlet_process’, weight_concentration_prior=None, mean_precision_prior=None, mean_prior=None, degrees_of_freedom_prior=None, covariance_prior=None, random_state=None, warm_start=False, verbose=0, verbose_interval=10)
[source]
fit(X, y=None)
[source]
Estimate model parameters with the EM algorithm.
The method fits the model n_init
times and sets the parameters with which the model has the largest likelihood or lower bound. Within each trial, the method iterates between Estep and Mstep for max_iter
times until the change of likelihood or lower bound is less than tol
, otherwise, a ConvergenceWarning
is raised. If warm_start
is True
, then n_init
is ignored and a single initialization is performed upon the first call. Upon consecutive calls, training starts where it left off.
Parameters: 


Returns: 

fit_predict(X, y=None)
[source]
Estimate model parameters using X and predict the labels for X.
The method fits the model n_init times and sets the parameters with which the model has the largest likelihood or lower bound. Within each trial, the method iterates between Estep and Mstep for max_iter
times until the change of likelihood or lower bound is less than tol
, otherwise, a ConvergenceWarning
is raised. After fitting, it predicts the most probable label for the input data points.
New in version 0.20.
Parameters: 


Returns: 

get_params(deep=True)
[source]
Get parameters for this estimator.
Parameters: 


Returns: 

predict(X)
[source]
Predict the labels for the data samples in X using trained model.
Parameters: 


Returns: 

predict_proba(X)
[source]
Predict posterior probability of each component given the data.
Parameters: 


Returns: 

sample(n_samples=1)
[source]
Generate random samples from the fitted Gaussian distribution.
Parameters: 


Returns: 

score(X, y=None)
[source]
Compute the persample average loglikelihood of the given data X.
Parameters: 


Returns: 

score_samples(X)
[source]
Compute the weighted log probabilities for each sample.
Parameters: 


Returns: 

set_params(**params)
[source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Returns: 


sklearn.mixture.BayesianGaussianMixture
© 2007–2018 The scikitlearn developers
Licensed under the 3clause BSD License.
http://scikitlearn.org/stable/modules/generated/sklearn.mixture.BayesianGaussianMixture.html