Skip to content

RFC new fitted attributes for LogisticRegressionCV #32075

@lorentzenchr

Description

@lorentzenchr

Contributes to #11865.

Fitted Attributes

After the removal of multi_class and any OvR-logic in LogisticRegressionCV in #32073, there are a few fitted attributes that have now (or always had) a strange data format (I neglect l1_ratios in the following for ease of reading):

  • coefs_paths_ is a dictionary with class labels as keys and arrays of shape (n_folds, n_cs, n_features) or similar as values.
    As coef_ is an array of shape (n_classes, n_features), coefs_paths_ should be an array of shape (n_folds, n_cs, n_classes, n_features), such that coefs_paths_[idx_fold, idx_cs, :, :] gives comparable coefficients. Maybe the intercept should be separated as intercepts_paths_.
  • scores_ is a dictionary with class labels as keys and arrays of shape (n_folds, n_cs) or similar as values. All values are the same regardless of the key (class label). This is a relict from OvR.
    A good value would be just an array of shape (n_folds, n_cs)
  • C_ is an array of shape (n_classes)
    As the different penalties for classes are gone with the removal of OvR, C_ should be a single float: the single best penalty parameter.
  • l1_ratio_ same as C_
  • n_iter_ is an array of shape (1, n_folds, n_cs) or similar
    The first dimension should be removed, i.e. shape (n_folds, n_cs)

Deprecation strategy

It is unclear to me how to accomplish the above. Options:

  1. Deprecate old attributes and introduce new ones with new names. (time = 2 releases)
  2. Same as 1. but then deprecate new ones and reintroduce the old names. (time = 4 releases)
  3. Deprecate old attributes and switch behavior in after the deprecation cycle (time = 2 releases)
  4. Another option?

Usually, we avoided deprecations options like 3.
@scikit-learn/core-devs recall for comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions