简体   繁体   English

TypeError:__init __()获得了意外的关键字参数'n_components'

[英]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.

相关问题 类型错误:PCA() 得到了一个意外的关键字参数“n_components” - TypeError: PCA() got an unexpected keyword argument 'n_components' TypeError: __init__() 得到了一个意外的关键字参数“n_folds” - TypeError: __init__() got an unexpected keyword argument 'n_folds' 类型错误:__init__() 得到了一个意外的关键字参数“n_iter” - TypeError: __init__() got an unexpected keyword argument 'n_iter' TypeError at &#39;&#39; __init__() 得到一个意外的关键字参数 &#39;&#39; - TypeError at '' __init__() got an unexpected keyword argument '' sklearn.cluster.KMeans 得到“TypeError:__init__() 得到了一个意外的关键字参数‘n_jobs’” - sklearn.cluster.KMeans got "TypeError: __init__() got an unexpected keyword argument 'n_jobs'" TypeError: __init__() 得到了一个意外的关键字参数 'n_jobs' 和 n_clusters - TypeError: __init__() got an unexpected keyword argument 'n_jobs' and n_clusters Hyperopt 分类任务引发错误“TypeError: __init__() got an unexpected keyword argument &#39;n_iter&#39;” - Hyperopt classification task raises error "TypeError: __init__() got an unexpected keyword argument 'n_iter' " SKLearn: TypeError: __init__() 得到了一个意外的关键字参数 n_splits - SKLearn: TypeError: __init__() got an unexpected keyword argument n_splits Scrapy错误:TypeError:__ init __()得到一个意外的关键字参数&#39;deny&#39; - Scrapy Error: TypeError: __init__() got an unexpected keyword argument 'deny' TypeError:__init __()得到了意外的关键字参数错误 - TypeError: __init__() got an unexpected keyword argument error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM