Skip to content

Fix SGDClassifier never has the attribute "predict_proba" - #10389

Closed
srajanpaliwal wants to merge 1 commit into
scikit-learn:masterfrom
srajanpaliwal:issue-10113
Closed

srajanpaliwal wants to merge 1 commit into
scikit-learn:masterfrom
srajanpaliwal:issue-10113

Conversation

@srajanpaliwal

@srajanpaliwal srajanpaliwal commented Jan 1, 2018 •

Copy link
Copy Markdown
Contributor

Reference Issues/PRs
Fixes #10113

What does this implement/fix? Explain your changes.
I implemented changes mentioned in the comment thread.

  • Changed predict_proba, so that it checks the after-fitting estimator. i.e it checks self.estimators_[0] instead of self.estimator.
  • Added predict_proba as a property in MultiOutputClassifier class which makes its implementation similar to other classifiers.

…log or modified_huber loss) (scikit-learn#10113)

	- Changed predict_proba so that it checks the after-fitting estimator.
	- Added predict_proba as a property in MultiOutputClassifier

@jnothman jnothman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test. Also change the PR title to reflect that this is not about SGDClassifier.

Comment thread sklearn/multioutput.py
def _predict_proba(self, X):
check_is_fitted(self, 'estimators_')
if not hasattr(self.estimator, "predict_proba"):
if not hasattr(self.estimators_[0], "predict_proba"):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These checks belong in the property definition for it to work.

@amueller

amueller commented Jun 2, 2018

Copy link
Copy Markdown
Member

Are you still working on this?

@amueller

amueller commented Aug 5, 2019

Copy link
Copy Markdown
Member

fixed in #12222.

@amueller amueller closed this Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SGDClassifier never has the attribute "predict_proba" (even with log or modified_huber loss)

3 participants