GridSearchCV 给出“ __init__() 得到意外的关键字参数 'n_topics'”

我正在谷歌协作笔记本中运行以下代码。我已经研究过这种类型的错误,并确保将我的 sklearn 版本更新到 0.24.dev0 之前,但错误仍然发生。有人可以帮忙吗?


search_params = {'n_components': [5, 10, 15, 20, 25], 'learning_decay': [.5, .7, .9]}


lda = LatentDirichletAllocation(max_iter=5, learning_method='online', learning_offset=50.,random_state=0)


model = GridSearchCV(lda, param_grid=search_params)


model.fit(data_vectorized)


GridSearchCV(cv=None, error_score='raise',

       estimator=LatentDirichletAllocation(batch_size=128, doc_topic_prior=None,

             evaluate_every=-1, learning_decay=0.7, learning_method=None,

             learning_offset=10.0, max_doc_update_iter=100, max_iter=10,

             mean_change_tol=0.001, n_components=10, n_jobs=1,

             n_topics=None, perp_tol=0.1, random_state=None,

             topic_word_prior=None, total_samples=1000000.0, verbose=0),

       fit_params=None, iid=True, n_jobs=1,

       param_grid={'n_topics': [5, 10, 15, 20, 25], 'learning_decay': [0.5, 0.7, 0.9]},

       pre_dispatch='2*n_jobs', refit=True, return_train_score='warn',

       scoring=None, verbose=0)


陪伴而非守候
浏览 200回答 1
1回答

梵蒂冈之花

0.19版更改:n_topics更名为n_components看起来所有版本 >=0.19 都保留此更改(我检查了 0.23)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python