可以尝试将tfidf_matrix.todense()改为tfidf_matrix,因为LdaModel需要一个稀疏矩阵作为输入,而todense()方法返回的是一个密集矩阵,导致出现了数值不匹配的错误。

修改后的代码如下:

da_model = gensim.models.ldamodel.LdaModel(tfidf_matrix, num_topics=8, id2word=dict(enumerate(feature_names)), passes=10)

da_model = gensimmodelsldamodelLdaModeltfidf_matrixtodense num_topics=8 id2word=dictenumeratefeature_names passes=10报错:ValueError not enough values to unpack

原文地址: https://www.cveoy.top/t/topic/dx5E 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录