Skip to content

Adjust variables when piling up selectors #309

Description

@gverbock

Is your feature request related to a problem? Please describe.
The variables argument works very well when having a single selector but then "piling up" selectors in a pipeline it does not account for the features removed in the previous steps.

For example if I want to have the pipeline running on only variables starting with "f_" I cannot run the following code because "f_A" is not defined anymore at the second step.

image

Removing the variables in the second selector does not help as the feature called 'E' is also removed

image

Describe the solution you'd like
I believe a selection at the beginning of the fit method would allow this feature. Something like:

if self.variables:
      self.variables = [var for var in self.variables if car in X.columns]

Describe alternatives you've considered
The alternative is to make the selection at the entry of the pipeline. Although, to me, this is not optimal as most dataframes do not only contain the features but also additional information needed further (could be a target or groups not used for modelling but for analysis).

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