Search code examples
scikit-learnclassificationcross-validationprecision-recall

Average values of precision, recall and fscore for each label


I'm cross validating a sklearn classifier model and want to quickly obtain average values of precision, recall and f-score. How can I obtain those values?

I don't want to code the cross validation by myself, instead I'm using the function cross_validation.cross_val_score. Is it possible to use this function to obtain the intended averaged values for each label, by supplying an adequate scoring function?


Solution

  • You can consider using all the method in sklearn.metrics package.

    I think this method could do the work you expect. It gives you a 2D array with one row for each target unique value and columns for precision, recall, fscore and support.

    For fast logging you can use classification_report too.