【发布时间】:2019-11-10 08:12:14
【问题描述】:
我使用 2 个类训练了 GMM 模型。我还测试了一些来自经过训练的 GMM 模型的样本数据。最后,我想得到每个类的 gmm 的概率。
我使用了名为 predict_proba 的 sklearn GaussianMixture 函数。但它显示在数组中。我怎样才能得到百分比?
for i in range(len(models)):
gmm = models[i] #checking with each model one by one
scores = np.array(gmm.score(vector))
a=gmm.predict_proba(vector)
print a.shape
log_likelihood[i] = scores.sum()
“a”的形状是 (1189L,2L) 和数据显示是这样的。
[[6.21130685e-06 9.99993789e-01]
[1.50996162e-15 1.00000000e+00]
[4.79883191e-14 1.00000000e+00]
...
[9.03135413e-08 9.99999910e-01]
[6.83288657e-12 1.00000000e+00]
[2.66804391e-08 9.99999973e-01]]
[[0.04394473 0.95605527]
[0.56844297 0.43155703]
[0.37858995 0.62141005]
...
[0.06809051 0.93190949]
[0.03412009 0.96587991]
[0.00584213 0.99415787]]
【问题讨论】:
-
你训练了两个 GMM 还是一个具有两个组件的 GMM?还有,输出到底有什么问题,
a * 100.0不会解决问题吗?