Reputation: 8177
We use a code like this to measure the accuracy, but I wanted to check which rows predictions were wrong. How can I do such thing?
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'])
Upvotes: 0
Views: 19
Reputation: 210942
assuming test_data
is a Pandas DataFrame:
test_data[predicted_mnb_lemmatized != test_data['COMPID']]
Upvotes: 2