sklearn fit_transform和转换行为

时间:2019-11-01 20:14:05

标签: python scikit-learn

$newArray = []; foreach ($startingArray as $item) { foreach ($item['student'] as $student) { if (empty($newArray[$student['id']])) { $student['subjects'] = []; $newArray[$student['id']] = $student; } $newArray[$student['id']]['subjects'][] = $item['subject']; } } fit_transform方法进行的这种小测试令人困惑。

我的语料库是一个字符串列表

transform

但是:

corpus = ['sentence 1',...] from sklearn.feature_extraction.text import TfidfVectorizer Vec = TfidfVectorizer() X_tfidf1 = Vec.fit_transform(corpus) X_tfidf2 = Vec.transform(corpus) 返回False,这对我来说没有意义,因为Vec符合我的语料,两个TFIDF矩阵不应该相同吗?

0 个答案:

没有答案