Skip to content

Add meta-estimator for switching between estimators #2994

Closed

Description

@kmike

Hi,

Using Pipeline and FeatureUnion one can combine multiple estimators into a single object and do a joint parameter selection. But they didn't help with a joint model selection if you want to use a different estimator class at some step (e.g. select a different classifier) or disable some step entirely (e.g. exclude some features).

What do you think about adding "Alternatives" or "Switch" or "EstimatorSelector" or "Selector" meta-estimator that will allow choose between estimators using its set_params?

fu = FeatureUnion([
    ('pca', Selector([
        ('linear', PCA()), 
        ('kernel', KernelPCA()),
        ('disabled', None),  # or something like ('disabled', NoFeatures()),
    ], estimator='linear')),
    ('truncated_svd', TruncatedSVD()),
])

Then you can use fu.set_params(pca__estimator='kernel', pca__kernel__n_components=10) or fu.set_params(pca__estimator='disabled'). We may also support fu.set_params(pca__estimator=None) directly without a need to define 'disabled' option.

Activity

  1. kmike commented on Mar 24, 2014

    @kmike
    ContributorAuthor

    Just found #1769 which provides a more intrusive but more user-friendly alternative for that.

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