question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sklearn.multiclass.OneVsRestClassifier documentation

See original GitHub issue

Is this documentation for sklearn.multiclass.OneVsRestClassifier correct?

Also known as one-vs-all, this strategy consists in fitting one classifier per class. For each classifier, the class is fitted against all the other classes. … In the multilabel learning literature, OvR is also known as the binary relevance method.

There is similar documentation in the user guide:

This strategy, also known as one-vs-all, is implemented in OneVsRestClassifier. The strategy consists in fitting one classifier per class. For each classifier, the class is fitted against all the other classes.

The prior section in the user guide talks about an example problem of multilabel classification as follows.

An array such as np.array([[1, 0, 0], [0, 1, 1], [0, 0, 0]]) represents label 0 in the first sample, labels 1 and 2 in the second sample, and no labels in the third sample.

All of these together do not make sense to me. The wording “For each classifier, the class is fitted against all the other classes” seems to imply a multi class problem, not a multi label problem. It seems like in the implementation it is actually fitting each label with its binary indicator independent of the other labels. I am further confused because the documentation says one vs. rest is the same as binary relevance, but the wikipedia article on multi-label classification seems to say otherwise:

This method of dividing the task into multiple binary tasks has something in common with the one-vs.-all (OvA, or one-vs.-rest, OvR) method for multiclass classification. Note though that it is not the same method: in binary relevance we train one classifier for each label, not one classifier for each possible value for the label.

For what it’s worth, it seems like sklearn.multiclass.OneVsRestClassifier implements what that wikipedia article would call binary relevance, not one vs. rest.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
jnothmancommented, Jun 21, 2020

It did indeed reach my inbox. I don’t think there was anything wrong with posting your comment; it displayed how difficult it is to deal with the mix of terminology. But hopefully there aren’t terribly many problems to solve here.

0reactions
joshuacwnewtoncommented, Jun 21, 2020

@jnothman Sorry about that! I agree that there isn’t as much of an issue as I had initially thought, and wish I hadn’t made the comment in the first place. I deleted my comment on GitHub soon after I had made it. But, I think because of email replying, it still reached your inbox.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sklearn.multiclass.OneVsRestClassifier
Also known as one-vs-all, this strategy consists in fitting one classifier per class. For each classifier, the class is fitted against all the...
Read more >
8.19.2. sklearn.multiclass.OneVsRestClassifier - GitHub Pages
Also known as one-vs-all, this strategy consists in fitting one classifier per class. For each classifier, the class is fitted against all the...
Read more >
One-vs-Rest and One-vs-One for Multi-Class Classification
Not all classification predictive models support multi-class classification. ... from sklearn.multiclass import OneVsRestClassifier.
Read more >
What is the difference between OneVsRestClassifier and ...
I've read documentation and I've understood that we use: OneVsRestClassifier - when we want to do multiclass or multilabel classification and ...
Read more >
NLP Multiclass - OneVsRestClassifier - Kaggle
Consists of 2225 documents from the BBC news website corresponding to stories ... LogisticRegression from sklearn.multiclass import OneVsRestClassifier from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found