相关疑难解决方法(0)

MiniBatchKMeans OverflowError:无法将浮点无穷大转换为整数?

k我正在尝试根据使用的轮廓分数找到正确的簇数sklearn.cluster.MiniBatchKMeans

from sklearn.cluster import MiniBatchKMeans
from sklearn.feature_extraction.text import HashingVectorizer

docs = ['hello monkey goodbye thank you', 'goodbye thank you hello', 'i am going home goodbye thanks', 'thank you very much sir', 'good golly i am going home finally']

vectorizer = HashingVectorizer()

X = vectorizer.fit_transform(docs)

for k in range(5):
    model = MiniBatchKMeans(n_clusters = k)
    model.fit(X)
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Warning (from warnings module):
  File "C:\Python34\lib\site-packages\sklearn\cluster\k_means_.py", line 1279
    0, n_samples - 1, init_size)
DeprecationWarning: This function is deprecated. Please call randint(0, 4 …
Run Code Online (Sandbox Code Playgroud)

python types infinity scikit-learn

4
推荐指数
1
解决办法
3684
查看次数

标签 统计

infinity ×1

python ×1

scikit-learn ×1

types ×1