【sklearn篇】mixture.GaussianMixture各参数详解以及代码实现

GaussianMixture

参量

  1. n_components
    混合高斯模型个数,默认为 1

  2. covariance_type
    协方差类型,{‘full’,‘tied’, ‘diag’, ‘spherical’}
    full 指每个分量有各自不同的标准协方差矩阵,完全协方差矩阵(元素都不为零)
    tied 指所有分量有相同的标准协方差矩阵(HMM 会用到)
    diag 指每个分量有各自不同对角协方差矩阵(非对角为零,对角不为零)
    spherical 指每个分量有各自不同的简单协方差矩阵,球面协方差矩阵(非对角为零,对角完全相同,球面特性),默认‘full’ 完全协方差矩阵

  3. tol
    EM 迭代停止阈值,默认为 1e-3 即 0.001.

  4. reg_covar
    协方差对角非负正则化,保证协方差矩阵均为正,默认为 0

  5. max_iter
    最大迭代次数,默认 100

  6. n_init
    初始化次数,用于产生最佳初始参数,默认为 1

  7. init_params
    初始化参数类型 {‘kmeans’, ‘random’}
    初始化参数实现方式,默认用 kmeans 实现,也可以选择随机产生

  8. weights_init
    各组成模型的先验权重,可以自己设,默认按照 7 产生

  9. means_init
    初始化均值,同 8

  10. precisions_init
    初始化精确度(模型个数,特征个数),默认按照 7 实现

  11. random_state
    随机数发生器

  12. warm_start
    若为 True,则 fit()调用会以上一次 fit()的结果作为初始化参数,适合相同问题多次 fit 的情况,能加速收敛,默认为 False。

  13. verbose
    使能迭代信息显示,默认为 0,可以为 1 或者大于 1(显示的信息不同)

  14. verbose_interval
    与 13 挂钩,若使能迭代信息显示,设置多少次迭代后显示信息,默认 10 次。

属性

  1. weights_ : array, shape (n_components,)
    This attribute stores the mixing weights for each mixture component.
    每个混合模型的权重。

  2. means_ : array, shape (n_components, n_features)
    Mean parameters for each mixture component.
    每个混合模型的均值。

  3. 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'
    
  4. converged_ : bool
    True when convergence was reached in fit(), False otherwise.
    当在fit()中达到收敛时为真,否则为假。

函数

  1. aic(X) Akaike information criterion for the current model on the input X.
    输入 X 上当前模型的 aic(X)Akaike 信息标准。
  2. bic(X) Bayesian information criterion for the current model on the input X.        
    输入 X 上当前模型的 bic(X)贝叶斯信息准则。
  3. fit(X[, y]) Estimate model parameters with the EM algorithm.              
    fit(X [,y])使用 EM 算法估算模型参数。
  4. get_params([deep]) Get parameters for this estimator.                
    get_params([deep])获取此估算器的参数。
  5. predict(X) Predict the labels for the data samples in X using trained model.        
    预测(X)使用训练模型预测 X 中数据样本的标签。
  6. predict_proba(X) Predict posterior probability of each component given the data.      
    predict_proba(X)预测给定数据的每个组件的后验概率。
  7. sample([n_samples]) Generate random samples from the fitted Gaussian distribution.    
    sample([n_samples])从拟合的高斯分布生成随机样本。
  8. score(X[, y]) Compute the per-sample average log-likelihood of the given data X.    
    得分(X [,y])计算给定数据 X 的每样本平均对数似然。
  9. score_samples(X) Compute the weighted log probabilities for each sample.      
    score_samples(X)计算每个样本的加权对数概率。
  10. set_params( ** params) Set the parameters of this estimator.              
    set_params(**params)设置此估算器的参数。
  • 24
    点赞
  • 107
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值