Skip to content

DOC better doc for SGDClassifier.partial_fit - #12767

Merged
qinhanmin2014 merged 5 commits into
scikit-learn:masterfrom
pierreglaser:DOC_better_doc_for_partial_fit_sgd
Feb 8, 2019
Merged

qinhanmin2014 merged 5 commits into
scikit-learn:masterfrom
pierreglaser:DOC_better_doc_for_partial_fit_sgd

Conversation

@pierreglaser

Copy link
Copy Markdown
Contributor

I found that the doc of SGDClassifier little bit unclear: it does not say explicitly that only one pass over X is carried out. This is what we would expect for a stochastic gradient object, but in other places of scikit-learn, partial_fit has a different meaning than this one.


Internally, this method uses ``max_iter = 1``. Therefore, it is not
guaranteed that a minimum of the cost function is reached after calling
it once. Objective convergence and callbacks such as early stopping

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.

What do you mean by callbacks here? I think callbacks have a specific meaning (at least in my mind) and I don't remember supporting them or having them here. You could say "Matters such as objective convergence or early stopping should be handled by the user.", or similar, I guess.

@pierreglaser pierreglaser Dec 14, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A standard definition for callbacks are functions you call periodically during the training procedure. early_stopping fits into this definition. But scikit-learn does not support user-defined callbacks, so using this term may be misleading. Is it what you had in mind?

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.

Exactly!

@adrinjalali adrinjalali 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.

Thanks!

@pierreglaser
pierreglaser force-pushed the DOC_better_doc_for_partial_fit_sgd branch from f2a216f to cb9e1d1 Compare December 14, 2018 14:02

def partial_fit(self, X, y, classes=None, sample_weight=None):
"""Fit linear model with Stochastic Gradient Descent.
"""Carry out stochastic gradient descent on one pass of X, y.

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.

Let's rephrase this a little:
"Perform one epoch of stochastic gradient descent on the given samples"
WDYT?

@pierreglaser pierreglaser Dec 17, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good.
Edit: actually, this sentence is 1 character too long. "On the given X, y"?

@qinhanmin2014 qinhanmin2014 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.

LGTM, thanks @pierreglaser

@qinhanmin2014
qinhanmin2014 merged commit fcf7fc0 into scikit-learn:master Feb 8, 2019
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Feb 19, 2019
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
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 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.

6 participants