Olivier_s_j
Olivier_s_j

Reputation: 5182

Precision of sklearn.metric classification_report

I would like to know if it is possible to get more numbers after the comma with classification_report from sklearn (scikit).

atm it looks like this:

         precision    recall  f1-score   support

      1       0.61      0.73      0.67     71194
      2       0.64      0.33      0.43     13877
      3       0.56      0.59      0.57     61591
      4       0.64      0.51      0.57     13187
      5       0.66      0.69      0.67     57530
      6       0.54      0.06      0.11      2391
      7       0.54      0.40      0.46     30223

avg / total 0.60 0.60 0.60 249993

I don't think it is possible with that method, but maybe someone had the same idea (probably).

I know that sklearn.metrics.precision_score exists, though the classification_report is such a nice way to display all the results at once.

Upvotes: 2

Views: 1255

Answers (1)

tiago
tiago

Reputation: 23492

Not possible according to the source code. See lines 819 and 830, format strings are hardcoded to %0.2f. If you really want it, just change it in your local file sklearn/metrics/metrics.py. Better yet, add an argument to classification_report with a precision number and use that. And submit your patch to the project!

Upvotes: 5

Related Questions