0
我有分類問題。我爲數據建立了一組功能。我用SVM進行分類。我想評估這些功能。打印前10個特徵的名稱及其卡方值
ch2=SelectKBest(score_func=chi2, k='all')
top_ranked_features = sorted(enumerate(ch2.scores_),key=lambda x:x[1], reverse=True)[:1000]
top_ranked_features_indices = map(list,zip(*top_ranked_features))[0]
for feature_pvalue in zip(np.asarray(featurenames)[top_ranked_features_indices],ch2.pvalues_[top_ranked_features_indices]):
print feature_pvalue
但是當我運行此我得到了以下錯誤
AttributeError: 'SelectKBest' object has no attribute 'scores_'
注:我沒有使用矢量化。我有列表名稱featurenames
中的功能名稱,我想打印所有或頂部K功能的名稱和卡方值