user961627
user961627

Reputation: 12747

Precision-recall curve with average='micro' for multiclass classifier in scikit-learn

All I'm doing is running the supplied code on this page: http://scikit-learn.org/stable/auto_examples/plot_precision_recall.html to find ROC curves.

All I've done is copied the code, but I'm getting this error:

TypeError: average_precision_score() got an unexpected keyword argument 'average'

What should I do to remove the error? I will want to use this for the multiclass case, so I do want to keep the "average='micro'" part.

Upvotes: 1

Views: 2568

Answers (1)

James King
James King

Reputation: 6355

The average argument did not exist before release 0.15, so I'm thinking you must have an old version of scikit-learn. See the change log:

"Multi-label classification output in multilabel indicator format is now supported by metrics.roc_auc_score and metrics.average_precision_score by Arnaud Joly."

The code runs for me under 0.15.2. See the second answer here to check the version of a python module at run time.

Upvotes: 2

Related Questions