【问题标题】:unexpected poor performance of GMM from sklearnsklearn 中 GMM 的意外性能不佳
【发布时间】:2015-02-10 12:54:57
【问题描述】:

我正在尝试使用 scikitlearn 的 DPGMM 分类器对一些模拟数据进行建模,但性能不佳。这是我正在使用的示例:

from sklearn import mixture
import numpy as np
import matplotlib.pyplot as plt
clf = mixture.DPGMM(n_components=5, init_params='wc')
s = 0.1
a = np.random.normal(loc=1, scale=s, size=(1000,))
b = np.random.normal(loc=2, scale=s, size=(1000,))
c = np.random.normal(loc=3, scale=s, size=(1000,))
d = np.random.normal(loc=4, scale=s, size=(1000,))
e = np.random.normal(loc=7, scale=s*2, size=(5000,))
noise = np.random.random(500)*8 
data = np.hstack([a,b,c,d,e,noise]).reshape((-1,1))
clf.means_ = np.array([1,2,3,4,7]).reshape((-1,1))
clf.fit(data)
labels = clf.predict(data)
plt.scatter(data.T, np.random.random(len(data)), c=labels, lw=0, alpha=0.2)
plt.show()

我认为这正是高斯混合模型可以解决的问题。我尝试过使用 alpha,使用 gmm 而不是 dpgmm,更改起始组件的数量等。我似乎无法获得可靠和准确的分类。有什么我只是想念的吗?还有其他更合适的模型吗?

【问题讨论】:

    标签: python scikit-learn classification cluster-analysis


    【解决方案1】:

    因为您没有足够长的迭代时间使其收敛

    检查值

    clf.converged_
    

    并尝试将n_iter 增加到1000

    但请注意,DPGMM 在此数据集上仍然惨遭恕我直言,最终将集群数量减少到只有 2 个。

    【讨论】:

      猜你喜欢
      • 2015-02-13
      • 2015-05-19
      • 2017-12-08
      • 1970-01-01
      • 1970-01-01
      • 2021-05-11
      • 2017-05-20
      • 1970-01-01
      • 2018-09-15
      相关资源
      最近更新 更多