以下是我将使用的数据集的一部分:
u'tff prep normalized clean water permability ncwp result outside operating range',
u'technician inadvertently omitted documenting initial room \u201c cleaned sanitized field form',
u'sunflower seed observed floor room 1',下面是我使用的代码:
tfidf_model = vectorizer.fit_transform(input_document_lower)
tfidf_feature_names = vectorizer.get_feature_names()
nmf = NMF(n_components=no_topics, random_state=1, alpha=.1, l1_ratio=.5, init='nndsvd').fit(tfidf_model)就像标题所说的,我得到了以下错误:
IndexError: index 4 is out of bounds for axis 1 with size 4老实说,我不确定如何开始调试。我使用相同的数据集构建了一个LDA,没有任何问题。任何帮助都将不胜感激
发布于 2018-01-17 06:08:05
我认为n_components应该小于(tfidf_model.shape,tfidf_model1)。
发布于 2018-08-23 06:28:12
正如Yotaro所说,n_components需要与no_topics相同或更小
no_topics,words = tfidf_model.shape
init='nndsvd').fit(tfidf_model) = NMF(n_components=no_topics,random_state=1,alpha=.1,l1_ratio=.5,nmf
发布于 2019-12-24 20:20:19
必须将no_topics变量设置为tfidf_model.shape的x坐标
https://stackoverflow.com/questions/47047881
复制相似问题