Search code examples
machine-learningscikit-learnprecision-recall

What does the last row mean in classification_report in scikit learn


I wonder what the last line which says avg / total mean in scikit-learn classification report? Is it macro average or micro average? For example in the following table taken from the documentation, what is the

         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

Solution

  • According to the source code, it is weighted average.

    # compute averages
    values = [last_line_heading]
    for v in (np.average(p, weights=s),
              np.average(r, weights=s),
              np.average(f1, weights=s)):
        values += ["{0:0.{1}f}".format(v, digits)]
    values += ['{0}'.format(np.sum(s))]
    

    You can look at this issue, which suggests that they are going to include all average methods. But it is not ready yet.