GaussianMixture
参量
-
n_components
混合高斯模型个数,默认为 1 -
covariance_type
协方差类型,{‘full’,‘tied’, ‘diag’, ‘spherical’}
full 指每个分量有各自不同的标准协方差矩阵,完全协方差矩阵(元素都不为零)
tied 指所有分量有相同的标准协方差矩阵(HMM 会用到)
diag 指每个分量有各自不同对角协方差矩阵(非对角为零,对角不为零)
spherical 指每个分量有各自不同的简单协方差矩阵,球面协方差矩阵(非对角为零,对角完全相同,球面特性),默认‘full’ 完全协方差矩阵 -
tol
EM 迭代停止阈值,默认为 1e-3 即 0.001. -
reg_covar
协方差对角非负正则化,保证协方差矩阵均为正,默认为 0 -
max_iter
最大迭代次数,默认 100 -
n_init
初始化次数,用于产生最佳初始参数,默认为 1 -
init_params
初始化参数类型 {‘kmeans’, ‘random’}
初始化参数实现方式,默认用 kmeans 实现,也可以选择随机产生 -
weights_init
各组成模型的先验权重,可以自己设,默认按照 7 产生 -
means_init
初始化均值,同 8 -
precisions_init
初始化精确度(模型个数,特征个数),默认按照 7 实现 -
random_state
随机数发生器 -
warm_start
若为 True,则 fit()调用会以上一次 fit()的结果作为初始化参数,适合相同问题多次 fit 的情况,能加速收敛,默认为 False。 -
verbose
使能迭代信息显示,默认为 0,可以为 1 或者大于 1(显示的信息不同) -
verbose_interval
与 13 挂钩,若使能迭代信息显示,设置多少次迭代后显示信息,默认 10 次。
属性
-
weights_ : array, shape (n_components,)
This attribute stores the mixing weights for each mixture component.
每个混合模型的权重。 -
means_ : array, shape (n_components, n_features)
Mean parameters for each mixture component.
每个混合模型的均值。 -
covars_ : array
Covariance parameters for each mixture component. The shape depends on covariance_type:
每个混合模型的协方差。矩阵大小取决于covariance_type定义的协方差矩阵类型(n_components, n_features) if 'spherical', (n_features, n_features) if 'tied', (n_components, n_features) if 'diag', (n_components, n_features, n_features) if 'full'
-
converged_ : bool
True when convergence was reached in fit(), False otherwise.
当在fit()中达到收敛时为真,否则为假。
函数
- aic(X) Akaike information criterion for the current model on the input X.
输入 X 上当前模型的 aic(X)Akaike 信息标准。 - bic(X) Bayesian information criterion for the current model on the input X.
输入 X 上当前模型的 bic(X)贝叶斯信息准则。 - fit(X[, y]) Estimate model parameters with the EM algorithm.
fit(X [,y])使用 EM 算法估算模型参数。 - get_params([deep]) Get parameters for this estimator.
get_params([deep])获取此估算器的参数。 - predict(X) Predict the labels for the data samples in X using trained model.
预测(X)使用训练模型预测 X 中数据样本的标签。 - predict_proba(X) Predict posterior probability of each component given the data.
predict_proba(X)预测给定数据的每个组件的后验概率。 - sample([n_samples]) Generate random samples from the fitted Gaussian distribution.
sample([n_samples])从拟合的高斯分布生成随机样本。 - score(X[, y]) Compute the per-sample average log-likelihood of the given data X.
得分(X [,y])计算给定数据 X 的每样本平均对数似然。 - score_samples(X) Compute the weighted log probabilities for each sample.
score_samples(X)计算每个样本的加权对数概率。 - set_params( ** params) Set the parameters of this estimator.
set_params(**params)设置此估算器的参数。