scikit tfidfvectoriz中的错误功能名称

2024-06-01 08:37:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用scikit learn的tfidfvectorizer,但是如果我不限制max\u特性(大约50个),特性名称将类似于u'00 9510477781' 当我设置max\u features=50或更少时,它会正确地显示feature\u名称(u'me'或u'book',…)

test_tf = TfidfVectorizer(analyzer='word', ngram_range=(1,2), min_df = 1, stop_words = 'english',max_features=50)
test_tfidf_matrix =  test_tf.fit_transform(test_corpus)
feature_names = test_tf.get_feature_names()

我做错了吗? p、 我使用的是python2.7


Tags: test名称namestf特性scikitlearnmax