0
我使用Scikit進行特徵選擇,但是我希望獲得文本中所有unigrams的分數值。我得到了分數,但是我如何將這些分數映射到實際的特徵名稱。如何在scikit中獲取卡方特徵選擇的分數對應的特徵名稱
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_selection import SelectKBest, chi2
Texts=["should schools have uniform","schools discipline","legalize marriage","marriage culture"]
labels=["3","3","7","7"]
vectorizer = CountVectorizer()
term_doc=vectorizer.fit_transform(Texts)
ch2 = SelectKBest(chi2, "all")
X_train = ch2.fit_transform(term_doc, labels)
print ch2.scores_
這給出了結果,但我怎麼知道哪些功能名稱映射到什麼得分?