Skip to content

warm-start aware grid search #1674

Closed
Closed

Description

@mblondel

A few estimators like Lasso support the warm_start option.

lasso = Lasso(warm_start=True)
scores = []
for alpha in alphas:
    lasso.set_params(alpha=alpha)
    lasso.fit(X_train, y_train)
    scores.append(lasso.score(X_test, y_test))

Due to how GridSearchCV is designed (use of clone, parallelism with n_jobs), setting the warm_start option wouldn't have any effect.

It would be nice to create a grid search object which can benefit from warm-start. n_jobs could still be supported but should be with respect to cross-validation folds.

This would require specifying with respect to what parameters the warm-starting must be done (e.g., alpha in the case of Lasso).

Activity

  1. amueller commented on Feb 11, 2013

    @amueller
    Member

    Isn't this basically what I propsed in #1626, where I also proposed a solution?

  2. amueller commented on Feb 22, 2013

    @amueller
    Member

    Do you agree this is a duplicate?

  3. mblondel commented on Feb 22, 2013

    @mblondel
    MemberAuthor

    Could you illustrate how your proposal in #1626 would be applied to solve warm-start aware grid-search?

  4. amueller commented on Feb 22, 2013

    @amueller
    Member

    Actually my proposal would not work via the "warm_start" option, but place the whole logic of how to compute a path in the estimator, not GridSearchCV. The idea would be to make it possible for GridSearchCV to discover for wich parameters there is a path option and let it give a list / grid to the estimator.

    So for example Lasso could have an attribute lasso.generalized_cv_params = ['alpha'].
    GridSearch will see that and pass the whole list of alphas to lasso.
    Then lasso will compute the scores for all alphas for a given fold.

    I'm not sure putting the work into the estimator is better than into GridSearchCV. I do think this is an important api issue and we should not scatter the discussion into multiple issues ;)

  5. amueller commented on Feb 22, 2013

    @amueller
    Member

    If there are more than one parameters that support warm_start (say max_depth and n_samples_split in the trees), GridSearchCV would need to know the correct sequence to take full advantage of the redundancy. I'm not sure that is a good idea. But maybe I'm thinking of overly complex cases.

  6. amueller commented on Feb 22, 2013

    @amueller
    Member

    Maybe using RFE together with SGDClassifier is a less far-fetched example.

  7. mblondel commented on Feb 23, 2013

    @mblondel
    MemberAuthor

    Thanks, your idea is much clearer now.
    On Feb 23, 2013 8:46 AM, "Andreas Mueller" [email protected] wrote:

    Maybe using RFE together with SGDClassifier is a less far-fetched example.

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

  8. amueller commented on Sep 29, 2016

    @amueller
    Member

    @jnothman you think this is covered by #1626 or you think this is better described elsewhere?

  9. jnothman commented on Sep 30, 2016

    @jnothman
    Member

    I think it is covered by #1626, partially addressed by model-specific CV
    estimators, and beyond that not clear enough to be easily addressed.

    On 30 September 2016 at 05:10, Andreas Mueller [email protected]
    wrote:

    @jnothman https://github.com/jnothman you think this is covered by #1626
    #1626 or you think
    this is better described elsewhere?

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    #1674 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/AAEz6-usnED6NiLtVFlxTp010uUbYzzvks5qvA0mgaJpZM4Aa-zL
    .

  10. robguinness commented on Nov 6, 2018

    @robguinness

    +1 for the idea of making use of warm-start in GridSearchCV. #1626 doesn't seem to address this directly, and considering that there hasn't been any movement on it in 5 years, would you be willing to reopen this issue, or should I submit a new related one?

    My use case is to make use of the warm_start option for RandomForestClassifier. This would require some coordination of the jobs sent to run in parallel, but it should be doable, right?

  11. jnothman commented on Nov 6, 2018

    @jnothman
    Member

    @robguinness, #8230 might be the sort of thing you're looking for... not that we have come to consensus on how much we like it.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions