1
var_vector = TfidfVectorizer()
train_var = var_vector.fit_transform(t_df['var'])

top_100 = np.array(var_vector.get_feature_names())
tfidf_100 = np.argsort(var_vector.idf_)[::-1]

n = 100
top_n = top_100[tfidf_100][:n]

从 tfidf Vectorizer 中选择前 100 个单词后,如何将维度更新为 100?

4

1 回答 1

0

max_features参数设置为100请参阅此处的文档

于 2018-06-13T07:34:43.587 回答