python-3.x - 使用分数度量评估高斯混合模型?

标签 python-3.x scikit-learn gaussian data-fitting mixture-model

我有一维数据(关于列数据)。我使用高斯混合模型 (GMM) 作为密度估计,在 Python 中使用此实现:https://scikit-learn.org/stable/modules/generated/sklearn.mixture.GaussianMixture.html 。通过依靠 AIC/BIC 标准,我能够确定组件的数量。在拟合 GMM 后,我绘制了原始观察值的核密度估计 + 从 GMM 中提取的采样数据的核密度估计。原始密度和采样密度的图非常相似(这很好)。但是,我想要一些指标来报告拟合模型的好坏。

g = GaussianMixture(n_components = 35)

data= df['x'].values.reshape(-1,1) # data taken from data frame (10,000 data pints)
clf= g.fit(data)# fit model

samples= clf.sample(10000)[0] # generate sample data points (same # as original data points)

我在实现中找到了分数,但不知道如何实现。我做错了吗?或者除了直方图或核密度图之外,还有其他更好的方法来显示拟合模型的准确性吗?

print(clf.score(data))
print(clf.score(samples))

最佳答案

您可以使用 normalized_mutual_info_scoreadjusted_rand_scoresilhouette 分数来评估您的集群。所有这些指标均在 sklearn.metrics 部分下实现。

编辑:您可以查看此link以获得更详细的解释。

总结:

  • 调整兰德指数:衡量两个作业的相似度。

  • 标准化互信息:衡量两个作业的一致性。

  • 轮廓系数:衡量每个点的分配情况。
gmm.fit(x_vec)

pred = gmm.predict(x_vec)

print ("gmm: silhouttte: ", silhouette_score(x_vec, pred))

关于python-3.x - 使用分数度量评估高斯混合模型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59827051/

相关文章:

python - TensorBoard 元数据 UnicodeDecodeError

python - tensorflow 中的分类器根据标签大小返回错误

python - 如何在 1d 中找到密集区域

python - 根据距0的y距离进行分组的聚类算法

c - 高斯混合 - C

linux - Python Flask 服务文件未启动

python - 在 Python 3 中使用 Pexpect

python - GridSearchCV 将为此运行多少种组合?

python-2.7 - 高斯NB :- ValueError: The sum of the priors should be 1

python - 使用 numpy 离散逼近高斯分布