我们使用这样的代码来衡量准确性,但我想检查哪些行预测是错误的。我该怎么办呢?
text_mnb_lemmatized = Pipeline([('vect', lemma_count_vect),
('tfidf', TfidfTransformer(sublinear_tf=True, use_idf=False)),
('mnb', MultinomialNB(alpha=0.1, fit_prior=True))])
text_mnb_lemmatized = text_mnb_lemmatized.fit(train_data['CDESCR'], train_data['COMPID'])
predicted_mnb_lemmatized = text_mnb_lemmatized.predict(test_data['CDESCR'])
np.mean(predicted_mnb_lemmatized == test_data['COMPID'])
答案 0 :(得分:2)
假设test_data
是Pandas DataFrame:
test_data[predicted_mnb_lemmatized != test_data['COMPID']]