Skip to content

MRG: SGDClassifier.predict_proba shape - #1030

Merged
pprett merged 6 commits into
scikit-learn:masterfrom
pprett:sgd-predict-proba
Aug 29, 2012
Merged

pprett merged 6 commits into
scikit-learn:masterfrom
pprett:sgd-predict-proba

Conversation

@pprett

@pprett pprett commented Aug 16, 2012

Copy link
Copy Markdown
Member

Changes shape of SGDClassifier.predict_proba to 2d array.

This PR adresses #1023

In addition, cosmit in the sgd documentation

@amueller

Copy link
Copy Markdown
Member

I'm +1 on doing this but not everybody is, so let's wait ;)

@agramfort

Copy link
Copy Markdown
Member

+1 for merge. I think everybody agrees with the fact that predict_proba should return a proba for each class. The problem is more with decision_function.

@amueller

Copy link
Copy Markdown
Member

I think @mblondel disagreed and I think he raised a vaild point.

@mblondel

Copy link
Copy Markdown
Member

I'm +1 on principle but my only worry is that SGDClassifier(loss="log") is quite popular so this will break user code.

@amueller

Copy link
Copy Markdown
Member

I'd like to hear @GaelVaroquaux opinion when he comes back, as he is usually quite conservative wrt API changes.

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.

I don't like this as it does not to what it says. This is equivalent to if class_weight which is not the same as if not class_weight is None.

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.

I am not sure what you mean by your remark, @amueller . 'foo is not None' is the right way to ensure that the test is not triggered only by the 'None' value.

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.

Sorry, I have some trouble parsing your statement. My point is that ''False is not None'' is a false statement while ''not False is None'' is a true statement. Afaik.

Sorry, on mobile right now.

Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

Gael Varoquaux [email protected] schrieb:

In sklearn/linear_model/stochastic_gradient.py:

@@ -449,7 +449,7 @@ def partial_fit(self, X, y, classes=None, > ------- > self : returns an instance of self. > """ > - if class_weight != None: > + if class_weight is not None:

I am not sure what you mean by your remark, @amueller . 'foo is not None' is the right way to ensure that the test is not triggered only by the 'None' value.

—
Reply to this email directly or view it on GitHub.

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.

My point is that ''False is not None'' is a false statement while ''not False is None'' is a true statement.

In [1]: False is not None
Out[1]: True

In [2]: not False is None
Out[2]: True

I think that the confusion comes from the fact that the Python
developers hacked the Python synthax for this to work.

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.

Seems I was wrong. A bit strange, though.

Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

Gael Varoquaux [email protected] schrieb:

In sklearn/linear_model/stochastic_gradient.py:

@@ -449,7 +449,7 @@ def partial_fit(self, X, y, classes=None, > ------- > self : returns an instance of self. > """ > - if class_weight != None: > + if class_weight is not None:

I am not sure what you mean by your remark, @amueller . 'foo is not None' is the right way to ensure that the test is not triggered only by the 'None' value.

—
Reply to this email directly or view it on GitHub.

@amueller

Copy link
Copy Markdown
Member

@ogrisel As you seem to do so reviewing atm, I'd love to have your opinion on this issue.

@amueller

Copy link
Copy Markdown
Member

As there seems to be no real opposition and if it is ok with @mblondel, I think we should merge.
That will help fix a lot of issues. I'll then do the fix for the decision function in QDA and LDA.

@mblondel

Copy link
Copy Markdown
Member

@ogrisel and @GaelVaroquaux haven't voiced their opinion yet :)

@GaelVaroquaux

Copy link
Copy Markdown
Member

I'd like to hear @GaelVaroquaux opinion when he comes back.

+1 on Merge.

@ogrisel

ogrisel commented Aug 29, 2012

Copy link
Copy Markdown
Member

+1 for consistent shapes across the project hence +1 for merging.

@pprett
pprett merged commit 053d1a5 into scikit-learn:master Aug 29, 2012
@pprett

pprett commented Aug 29, 2012

Copy link
Copy Markdown
Member Author

i think we have enough +1 to merge - thanks for the feedback

@amueller

Copy link
Copy Markdown
Member

Thanks for the fix :)

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.

6 participants