Skip to content

Introduce a solver="auto" for LogisticRegression #5736

Closed

Description

@GaelVaroquaux

Logistic regression has many different possible solvers. Choosing the best is difficult and requires expert knowledge.

I think that it would be useful to introduce a 'solver="auto"' that tries to make a good guess on the best approach. It would have to be tuned using heaving benchmarks on many different problems.

A good place to start is using the script bench_rcv1_logreg_convergence.py in benchmarks, and applying it to a variety of problems.

Would people agree with such an idea?

Activity

  1. added
    Moderate
    on Nov 5, 2015
  2. dohmatob commented on Nov 5, 2015

    @dohmatob
    Contributor

    Good idea.

  3. MechCoder commented on Nov 5, 2015

    @MechCoder
    Member

    +1

  4. FedericoV commented on Nov 5, 2015

    @FedericoV
    Contributor

    I think that's an excellent idea.

    What are the things that have to be taken into account?

    • The obvious are: number of samples, number of features, sparsity

    After that:

    • Colinearity (but how to efficiently estimate it? do a PCA and look at cumulative explained variance?)
    • Presence or absence of one hot encoded features

    Anything else that jumps to mind?

  5. mblondel commented on Nov 6, 2015

    @mblondel
    Member

    Let's build a classifier which predicts the best classifier from the data characteristics!

  6. GaelVaroquaux commented on Nov 6, 2015

    @GaelVaroquaux
    MemberAuthor

    Multi colinearity will be expansive to estimate, I fear. Unless someone has a good idea (maybe based on a randomized PCA very low rank.

  7. y1yang0 commented on Nov 8, 2015

    @y1yang0

    @mblondel but it's a recursive problem

  8. amueller commented on Nov 9, 2015

    @amueller
    Member

    @mblondel I was thinking that it is pretty close to meta-learning

    @racaljk not really... your dataset for training the meta learner must "just" be large enough ;)

    I think it's a good idea. Would you include only the ones that are in LogisticRegression, though?
    The benchmark that possibly inspired this issue was comparing against vw, for which SGDClassifier is a closer match.

    Sometimes we make classes per model, sometimes per optimizer.
    SGDClassifier implements one solver for many models / losses.
    LogisticRegression implements one loss with many optimizers.

    I think the heuristic we use is mostly "do they share parameters", though that is not followed for ExtraTreesX and RandomForestX, which are simple two classes for different default parameters, so here classes are a shortcut for sets of default values.

    Having an "auto" solver for LogisticRegression (and I think also in LinearSVC for "dual") is a step in the right direction. Not including SGDClassifier is a bit problematic, though.

  9. amueller commented on Jun 8, 2020

    @amueller
    Member

    wanted to link this to #14269 which is basically the same for Ridge

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

    EnhancementModerateNew Featuremodule:linear_model

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions