[MRG+1] Ovr/OVO classifier decision_function shape fixes#9100
Merged
vene merged 5 commits intoscikit-learn:masterfrom Jun 10, 2017
Merged
[MRG+1] Ovr/OVO classifier decision_function shape fixes#9100vene merged 5 commits intoscikit-learn:masterfrom
vene merged 5 commits intoscikit-learn:masterfrom
Conversation
Member
Author
|
Found via #8022. |
vene
reviewed
Jun 10, 2017
| """ | ||
| Y = self.decision_function(X) | ||
| if self.n_classes_ == 2: | ||
| return self.classes_[(Y > 0).astype(np.int)] |
Member
There was a problem hiding this comment.
This assumes that estimators_[0].decision_function correctly returns a vector. Are we relying on check_estimator to validate this, or should we check it here?
Member
Author
There was a problem hiding this comment.
no we should assume that base_estimator actually works. Otherwise everything in sklearn is broken ;)
sklearn/tests/test_multiclass.py
Outdated
| y_pred = clf.predict(np.array([[0, 0, 4]]))[0] | ||
| assert_equal(set(y_pred), set("eggs")) | ||
| dec = clf.decision_function(X) | ||
| assert_equal(dec.shape, (5,)) |
Member
There was a problem hiding this comment.
PEP8: missing space after comma
| # first binary | ||
| ovo_clf.fit(iris.data, iris.target == 0) | ||
| decisions = ovo_clf.decision_function(iris.data) | ||
| assert_equal(decisions.shape, (n_samples,)) |
Member
|
LGTM. 👍 |
Member
|
Aside from the PEP8 issues :) |
Member
|
LGTM +1 for merge when travis is happy |
vene
reviewed
Jun 10, 2017
sklearn/tests/test_multiclass.py
Outdated
| assert_equal(set(y_pred), set("eggs")) | ||
| if hasattr(base_clf, 'decision_function'): | ||
| dec = clf.decision_function(X) | ||
| assert_equal(dec.shape, (5,)) |
Member
There was a problem hiding this comment.
this breaks travis, line needs to be indented deeper
Member
Author
|
green! @vene? |
Sundrique
pushed a commit
to Sundrique/scikit-learn
that referenced
this pull request
Jun 14, 2017
* fix OVR classifier edgecase bugs * add regression tests for OVO and OVR decision function shapes
dmohns
pushed a commit
to dmohns/scikit-learn
that referenced
this pull request
Aug 7, 2017
* fix OVR classifier edgecase bugs * add regression tests for OVO and OVR decision function shapes
dmohns
pushed a commit
to dmohns/scikit-learn
that referenced
this pull request
Aug 7, 2017
* fix OVR classifier edgecase bugs * add regression tests for OVO and OVR decision function shapes
NelleV
pushed a commit
to NelleV/scikit-learn
that referenced
this pull request
Aug 11, 2017
* fix OVR classifier edgecase bugs * add regression tests for OVO and OVR decision function shapes
paulha
pushed a commit
to paulha/scikit-learn
that referenced
this pull request
Aug 19, 2017
* fix OVR classifier edgecase bugs * add regression tests for OVO and OVR decision function shapes
AishwaryaRK
pushed a commit
to AishwaryaRK/scikit-learn
that referenced
this pull request
Aug 29, 2017
* fix OVR classifier edgecase bugs * add regression tests for OVO and OVR decision function shapes
maskani-moh
pushed a commit
to maskani-moh/scikit-learn
that referenced
this pull request
Nov 15, 2017
* fix OVR classifier edgecase bugs * add regression tests for OVO and OVR decision function shapes
jwjohnson314
pushed a commit
to jwjohnson314/scikit-learn
that referenced
this pull request
Dec 18, 2017
* fix OVR classifier edgecase bugs * add regression tests for OVO and OVR decision function shapes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OVR Classifier had a
decision_functionshape of(n_samples, 1)for binary classification, OVO classifier had(n_samples, 2)!Fixed to conform to standard API.