[scikit-learn] top N accuracy classification metric

Johnson, Jeremiah Jeremiah.Johnson at unh.edu
Fri Jan 20 14:16:54 EST 2017


Hi all,

It's common to use a top-n accuracy metric for multi-class classification problems, where for each observation the prediction is the set of probabilities for each of the classes, and a prediction is top-N accurate if the correct class is among the N highest predicted probability classes. I've written a simple implementation, but I don't think it quite fits the sklearn api. Specifically, _check_targets objects to the the continuous-multioutput format of the predictions for a classification task. Is there any interest in including a metric like this? I'd be happy to submit a pull request.

Jeremiah

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20170120/7900ef47/attachment.html>


More information about the scikit-learn mailing list