Skip to content

Deprecate n_iter in SGDClassifier and implement max_iter. #5022

Closed

Description

@ogrisel

We should implement a stopping condition based on the scaled norm of the parameter update as done in the new SAG solver for LogisticRegression / Ridge. The convergence check should be done at the end of the each epoch to avoid introducing too much overhead.

Other classes sharing the same underlying implementation should be updated as well, e.g.:

  • SGDRegressor
  • PassiveAggressiveClassifier
  • Perceptron

maybe others.

We should store the effective number of iterations in a new n_iter_ attribute on the estimator at the end of fit as done in many other scikit-learn model that accept a max_iter hyperparam.

Activity

  1. ogrisel commented on Jul 23, 2015

    @ogrisel
    MemberAuthor

    @TomDLT this one is for you if you like ;)

  2. TomDLT commented on Jul 24, 2015

    @TomDLT
    Member

    Ok :)
    About deprecation, is it the correct way to do it ? :

    • SGDClassifier().fit(X,y) may change its behavior, but SGDClassifier(n_iter=10).fit(X,y) should behave the same as before and raise a DeprecationWarning.

    What about ? :

    • add parameters max_iter=5 and tol=1e-4. also change n_iter=None
    • if n_iter is not None, use max_iter = n_iter and tol = 0.

    Should n_iter stay at the same place in the parameters?

  3. amueller commented on Jul 30, 2015

    @amueller
    Member

    hm... or we could directly go all the way and do a validation set? ;)

  4. amueller commented on Jul 30, 2015

    @amueller
    Member

    but yeah, first doing max_iter is probably a good idea.

  5. qinhanmin2014 commented on May 29, 2018

    @qinhanmin2014
    Member

    Resolved in #5036

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions