# what does the numbers in the classification report of sklearn mean?

I have below an example I pulled from sklearn 's sklearn.metrics.classification_report documentation.

What I don't understand is why there are f1-score, precision and recall values for each class where I believe class is the predictor label? I thought the f1 score tells you the overall accuracy of the model. Also, what does the support column tell us? I couldn't find any info on that.

print(classification_report(y_true, y_pred, target_names=target_names))
precision    recall  f1-score   support

class 0       0.50      1.00      0.67         1
class 1       0.00      0.00      0.00         1
class 2       1.00      0.67      0.80         3

avg / total       0.70      0.60      0.61         5


The f1-score gives you the harmonic mean of precision and recall. The scores corresponding to every class will tell you the accuracy of the classifier in classifying the data points in that particular class compared to all other classes.

The support is the number of samples of the true response that lie in that class.

You can find documentation on both measures in the sklearn documentation.

EDIT

The last line gives a weighted average of precision, recall and f1-score where the weights are the support values. so for precision the avg is (0.50*1 + 0.0*1 + 1.0*3)/5 = 0.70. The total is just for total support which is 5 here.

• what about the last line avg / total? It does not seem to match the column means... How is it computed and what does it mean? – Antoine Oct 19 '16 at 8:03
• @Antoine I am also wondering the same. Did you find out how is it calculated? – Pale Blue Dot May 16 '17 at 15:32
• @Antoine The last line gives a weighted average of precision, recall and f1-score where the weights are the support values. so for precision the avg is (0.50*1 + 0.0*1 + 1.0*3)/5 = 0.70. The total is just for total support which is 5 here. – Nitin May 21 '17 at 3:56
• Thanks to previous answer of @Nitin I found by links the best visual descriptions and intuition behind math: en.wikipedia.org/wiki/Precision_and_recall en.wikipedia.org/wiki/F1_score – Bogdan Korecki Oct 2 '18 at 16:16