我正在尝试应用LatentDirichletAllocation数据集。当我尝试为n_componentLDA的参数赋值时。我收到以下错误。
TypeError Traceback (most recent call last)
<ipython-input-25-6f5cf163fcaf> in <module>()
23 # tfidf = vectorizer.fit_transform(line)
24 # print(tfidf)
---> 25 lda = LatentDirichletAllocation(n_components = 100)
26 lda.fit(bag_of_words)
27 tf_feature_names = vector.get_feature_names()
TypeError: __init__() got an unexpected keyword argument 'n_components'
Run Code Online (Sandbox Code Playgroud)
如果您使用的是旧版本的 sklearn (< 0.19),则应使用n_topicsarg 代替n_components
lda = LatentDirichletAllocation(n_topics=100)
Run Code Online (Sandbox Code Playgroud)
旧界面的文档在0.18 版中可用sklearn.LatentDirichletAllocation
| 归档时间: |
|
| 查看次数: |
7994 次 |
| 最近记录: |