在spyders上做LDA模型
from sklearn.decomposition import LatentDirichletAllocation
n_components = 3
lda = LatentDirichletAllocation(n_topics=n_components, max_iter=50,
learning_method='online',
learning_offset=50.,
random_state=0)
lda.fit(tf)
TypeError: init() got an unexpected keyword argument 'n_topics'
看看是不是你那个方法写的不是n_topics
LatentDirichletAllocation这个方法没有n_topics这个参数,参数名是不是写错了