Classification Report

noun

say it: “klas-uh-fih-KAY-shun rih-PORT” /ˌklæsəfɪˈkeɪʃən rɪˈpɔrt/

In scikit-learn, a printed summary of a classifier's precision, recall, F1 score and number of examples for each category.

What is a classification report in scikit-learn?

A classification report is scikit-learn's printed table, from classification_report(), of precision, recall, F1 score and support (how many real examples) for every class, with accuracy and averages below. It's the quick way to see every class's scores at once.

from sklearn.metrics import classification_report
actual = ["fraud", "ok", "ok", "fraud", "fraud", "ok"]
guessed = ["fraud", "ok", "fraud", "ok", "fraud", "ok"]
print(classification_report(actual, guessed))
#               precision    recall  f1-score   support
#        fraud       0.67      0.67      0.67         3
#           ok       0.67      0.67      0.67         3
# then accuracy, and the macro and weighted averages

In a sentence

  • “The classification report showed the fraud class's recall was only 0.4.”
  • “One line of code printed a classification report for all three fruit classes.”

Level: Journeyman · More Python terms at this level

Updated