[MRG+2] FIX: force consistency outputs of DummyClassifier's predict_proba when strategy is stratified#13266
Merged
glemaitre merged 3 commits intoscikit-learn:masterfrom Feb 26, 2019
Conversation
glemaitre
requested changes
Feb 26, 2019
Member
glemaitre
left a comment
There was a problem hiding this comment.
LGTM. Could you add an entry to the what's new since it is impacting the end-user.
sklearn/tests/test_dummy.py
Outdated
| model.fit(X, y) | ||
| probas = model.predict_proba(X) | ||
|
|
||
| assert probas.dtype == np.float |
Member
There was a problem hiding this comment.
Suggested change
| assert probas.dtype == np.float | |
| assert probas.dtype == np.float64 |
sklearn/tests/test_dummy.py
Outdated
| y = [0, 2, 1, 1] | ||
| X = [[0]] * 4 | ||
| model = DummyClassifier(strategy=strategy, random_state=0, constant=0) | ||
| model.fit(X, y) |
Member
There was a problem hiding this comment.
Suggested change
| model.fit(X, y) | |
| probas = model.fit(X, y).predict_proba(X) |
sklearn/tests/test_dummy.py
Outdated
| ]) | ||
| def test_dtype_of_classifier_probas(strategy): | ||
| y = [0, 2, 1, 1] | ||
| X = [[0]] * 4 |
Member
There was a problem hiding this comment.
Suggested change
| X = [[0]] * 4 | |
| X = np.zeros(4) |
sklearn/tests/test_dummy.py
Outdated
| assert_array_equal(predictions1, predictions2) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("strategy", [ |
Member
There was a problem hiding this comment.
Suggested change
| @pytest.mark.parametrize("strategy", [ | |
| @pytest.mark.parametrize( | |
| "strategy", ["stratified", "most_frequent", "prior", "uniform", "constant"] | |
| ) |
If it fits on the 80 characters it would be more compact
glemaitre
reviewed
Feb 26, 2019
doc/whats_new/v0.21.rst
Outdated
| :user:`William de Vazelhes<wdevazelhes>`. | ||
|
|
||
| :mod:`sklearn.dummy` | ||
| .................................... |
Member
There was a problem hiding this comment.
Suggested change
| .................................... | |
| .................... |
glemaitre
approved these changes
Feb 26, 2019
Member
|
LGTM apart of long line in whats new |
agramfort
approved these changes
Feb 26, 2019
Member
|
Thanks Christos!!!
…On Tue, 26 Feb 2019 at 16:10, Alexandre Gramfort ***@***.***> wrote:
***@***.**** approved this pull request.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#13266 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHG9Px7GG8C9Q8HkMQTPGAKltUNQy8XXks5vRU5KgaJpZM4bQcQT>
.
--
Guillaume Lemaitre
INRIA Saclay - Parietal team
Center for Data Science Paris-Saclay
https://glemaitre.github.io/
|
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
…en strategy is stratified (scikit-learn#13266)" This reverts commit b755027.
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
…en strategy is stratified (scikit-learn#13266)" This reverts commit b755027.
koenvandevelde
pushed a commit
to koenvandevelde/scikit-learn
that referenced
this pull request
Jul 12, 2019
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.
What does this implement/fix? Explain your changes.
The DummyClassifier's
predict_probamethod returns afloat64array in all strategies except the stratified strategy which returns aint32array.