对$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矩阵不应该相同吗?