scikit-learn 已弃用 GMM.eval() 替换

scikit-learn deprecated GMM.eval() replacement

scikit-learn 0.11 版 sklearn.mixture.GMM 下的 eval() 方法已弃用。最新版本0.19.2是否有类似的方法或解决方法?

从旧版 scikit-learn 的 docs 中,您可以阅读以下内容:

DEPRECATED: GMM.eval was renamed to GMM.score_samples in 0.14 and will be removed in 0.16.

所以我认为你应该使用 score_samples()

求值(X)

参数:

X: array_like, shape (n_samples, n_features) : n_features维数据点列表。每行对应一个数据点。

Returns :

logprob: array_like, shape (n_samples,) : X

中每个数据点的对数概率

职责:array_like,形状(n_samples,n_components):

每个观察的每个混合成分的后验概率

显然,新定义中没有解决方法,它是相同且非常简洁的定义

当前获取职责的方法是predict_proba()

predict_proba(): Predict posterior probability of each component given the data.

现在你可能认为描述没有说责任。但这就是你需要的。

从 GMM 到 GaussianMixture class 的转变已在此处进行了彻底讨论:

这里描述了您需要的答案:

如作者在 this comment

中所述,您可能会看到一些不同的结果

The old one had a pretty strong regularization, the new one does not (by default).

您也可以查看源代码以验证这确实是 returns 职责。