0
Map object is not subscriptable error 을 참조하여 기능 이름을 얻으려면 Moses Xu 대답을 사용했습니다. "Map object is subscriptable"오류가 발생합니다. 코드는 다음과 같습니다. 파이썬 3.x를 사용하고 있습니다.선택한 기능을 점수로 가져 오는 방법은 무엇입니까?
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(train_vectorizer.get_feature_names())[top_ranked_features_indices],ch2.pvalues_[top_ranked_features_indices]):
print(feature_pvalue).
오류는 두 번째 코드 줄에 있습니다. 파이썬 3.x의에서
OUTPUT
('00 8b 4d fc', 3.4028916591534005e-61)
('51 00 22 05', 3.4028916591534005e-61)
('00 74 00 61', 8.3973527363656966e-61)
대단히 감사합니다. 그것은 효과가 있었다. – banu
@banu 같은 게시물에 추가 질문을 추가하면 엉망이 생깁니다. 오류가 발생하고 적절한 출력이있는 것처럼 보입니다. 두 번째 질문을 삭제하십시오. 새 게시물에 새 질문을하거나 기존 솔루션을 검색 할 수 있습니다. – Eran
확인. 안내해 주셔서 감사합니다. – banu