0
私はK平均に非常に新しいので、誰かが私に次の問題で助けてくれることを願っています。私はちょうどそれを試してみましたK平均クラスタリング、クラスタ数よりも少ないサンプル数
mbk = MiniBatchKMeans(n_clusters=3, init_size=400, batch_size=300, verbose=1).fit(model_dm.docvecs[:20000])
:
/usr/local/lib64/python2.7/site-packages/sklearn/utils/validation.py:386: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and willraise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.
DeprecationWarning)
ValueErrorTraceback (most recent call last)
<ipython-input-6-43cf0431aa1e> in <module>()
6
7
----> 8 mbk = MiniBatchKMeans(n_clusters=3, init_size=400, batch_size=300, verbose=1).fit(model_dm.docvecs[20000])
9
10
/usr/local/lib64/python2.7/site-packages/sklearn/cluster/k_means_.pyc in fit(self, X, y)
1236 n_samples, n_features = X.shape
1237 if n_samples < self.n_clusters:
-> 1238 raise ValueError("Number of samples smaller than number "
1239 "of clusters.")
1240
ValueError: Number of samples smaller than number of clusters.