-
-
Notifications
You must be signed in to change notification settings - Fork 26k
[MRG+1] Return list instead of 3d array for MultiOutputClassifier.predict_proba #8095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MRG+1] Return list instead of 3d array for MultiOutputClassifier.predict_proba #8095
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM, thanks!
@@ -214,16 +214,18 @@ def predict_proba(self, X): | |||
|
|||
Returns | |||
------- | |||
T : (sparse) array-like, shape = (n_samples, n_classes, n_outputs) | |||
The class probabilities of the samples for each of the outputs | |||
p : array of shape = [n_samples, n_classes], or a list of n_outputs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this type spec to render correctly as one line, you need a \
at the end of the line.
@@ -150,6 +153,39 @@ def test_multiclass_multioutput_estimator(): | |||
list(predictions[:, i])) | |||
|
|||
|
|||
def test_multiclass_multioutput_estimator_predict_proba(): | |||
# make test deterministic | |||
rs = np.random.RandomState(123456) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention we use rng
, not rs
- Changed `rs` to `rng` to follow convention. - Made sure changes were flake8 approved - Add `\` to continue docstring for `predict_proba` return value.
New commit has the requested changes. |
`np.random.choice` isn’t available in Numpy 1.6, so opt for the Python version instead.
CI passing, should be good to go 🏇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove sneaky log file and it's good to me
@@ -0,0 +1,1535 @@ | |||
rm -f tags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably need to remove this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Of course, after you remove the .log. Please add an entry to what's new. Or even one under API changes and one under bug fixes. |
Thanks @pjbull... Merging once appveyor becomes green... |
Thanks for identifying and fixing this, @pjbull |
…dict_proba (scikit-learn#8095) * Return list instead of 3d array for MultiOutputClassifier.predict_proba * Update flake8, docstring, variable name - Changed `rs` to `rng` to follow convention. - Made sure changes were flake8 approved - Add `\` to continue docstring for `predict_proba` return value. * Sub random.choice for np.random.choice `np.random.choice` isn’t available in Numpy 1.6, so opt for the Python version instead. * Make test labels deterministic * Remove hanging chad... * Add bug fix and API change to whats new
…dict_proba (scikit-learn#8095) * Return list instead of 3d array for MultiOutputClassifier.predict_proba * Update flake8, docstring, variable name - Changed `rs` to `rng` to follow convention. - Made sure changes were flake8 approved - Add `\` to continue docstring for `predict_proba` return value. * Sub random.choice for np.random.choice `np.random.choice` isn’t available in Numpy 1.6, so opt for the Python version instead. * Make test labels deterministic * Remove hanging chad... * Add bug fix and API change to whats new
…dict_proba (scikit-learn#8095) * Return list instead of 3d array for MultiOutputClassifier.predict_proba * Update flake8, docstring, variable name - Changed `rs` to `rng` to follow convention. - Made sure changes were flake8 approved - Add `\` to continue docstring for `predict_proba` return value. * Sub random.choice for np.random.choice `np.random.choice` isn’t available in Numpy 1.6, so opt for the Python version instead. * Make test labels deterministic * Remove hanging chad... * Add bug fix and API change to whats new
…dict_proba (scikit-learn#8095) * Return list instead of 3d array for MultiOutputClassifier.predict_proba * Update flake8, docstring, variable name - Changed `rs` to `rng` to follow convention. - Made sure changes were flake8 approved - Add `\` to continue docstring for `predict_proba` return value. * Sub random.choice for np.random.choice `np.random.choice` isn’t available in Numpy 1.6, so opt for the Python version instead. * Make test labels deterministic * Remove hanging chad... * Add bug fix and API change to whats new
…dict_proba (scikit-learn#8095) * Return list instead of 3d array for MultiOutputClassifier.predict_proba * Update flake8, docstring, variable name - Changed `rs` to `rng` to follow convention. - Made sure changes were flake8 approved - Add `\` to continue docstring for `predict_proba` return value. * Sub random.choice for np.random.choice `np.random.choice` isn’t available in Numpy 1.6, so opt for the Python version instead. * Make test labels deterministic * Remove hanging chad... * Add bug fix and API change to whats new
Reference Issue
Fixes #8093
What does this implement/fix? Explain your changes.
Returns a list of the predicted probabilities for each estimator in the
MultiOutputClassifier
rather than trying to stack them into a 3d matrix.Any other comments?
This is the same behavior now as the
RandomForestClassifier
, which handles data of this shape without being wrapped in theMultiOutputClassifier
.