Skip to content

RFC Set print_changed_only=True by default for meta-estimators #14008

Closed

Description

@rth

Since 0.21 there is config option to only print the changed parameters in estimators. #13991 enabled it by default for docstrings which helps readability significantly.

Do we want to also make it default in general, at least for meta-estimators? Once one starts using Pipeline e.g. with ColumnTransformer etc the full repr is fairly difficult to parse and has mostly irrelevant information,

>>> from sklearn.pipeline import Pipeline
>>> from sklearn.svm import SVC
>>> from sklearn.decomposition import PCA
>>> pipe = Pipeline([('reduce_dim', PCA(n_components=10)), ('clf', SVC(C=0.1))])
>>> pipe
Pipeline(memory=None,
         steps=[('reduce_dim',
                 PCA(copy=True, iterated_power='auto', n_components=10,
                     random_state=None, svd_solver='auto', tol=0.0,
                     whiten=False)),
                ('clf',
                 SVC(C=0.1, break_ties=False, cache_size=200, class_weight=None,
                     coef0=0.0, decision_function_shape='ovr', degree=3,
                     gamma='scale', kernel='rbf', max_iter=-1,
                     probability=False, random_state=None, shrinking=True,
                     tol=0.001, verbose=False))],
         verbose=False)
>>> with sklearn.config_context(print_changed_only=True):
...     print(pipe)
Pipeline(steps=[('reduce_dim', PCA(n_components=10)), ('clf', SVC(C=0.1))])

I don't see users setting print_changed_only=True config value in each notebook they use and IMO better defaults would be welcome.

Maybe this could involve changing the default to print_changed_only=None and then having a different behavior depending on if it's a meta-estimator or not.

I'm not quite sure what backward compatibility constraints this has.

Activity

  1. jnothman commented on Jun 3, 2019

    @jnothman
    Member
  2. amueller commented on Jun 5, 2019

    @amueller
    Member

    I would be on-board with making it the global default. @GaelVaroquaux might think differently?

  3. jnothman commented on Jun 5, 2019

    @jnothman
    Member
  4. GaelVaroquaux commented on Jun 5, 2019

    @GaelVaroquaux
    Member
  5. rth commented on Jun 3, 2020

    @rth
    MemberAuthor

    Closing as this is enabled by default since 0.23

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

    Needs Decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions