[英]TypeError: __init__() got an unexpected keyword argument 'n_components'
I'm trying to apply LatentDirichletAllocation
on a dataset. 我正在尝试在数据集上应用
LatentDirichletAllocation
。 When I try to assign a value to the n_component
argument of LDA. 当我尝试为LDA的
n_component
参数分配值时。 I get the below error. 我收到以下错误。
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'
If you are using an older version of sklearn (< 0.19) you should use the n_topics
arg in place of n_components
如果您使用的是较旧版本的sklearn(<0.19),则应使用
n_topics
arg代替n_components
lda = LatentDirichletAllocation(n_topics=100)
The documentation for the older interface is available in sklearn.LatentDirichletAllocation
version 0.18 sklearn.LatentDirichletAllocation
版本0.18中提供了旧界面的文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.