Dynamic evaluation of Sklearn(Imblearn) Pipeline parameters

95 Views Asked by At

I have an Imblearn pipeline:

from imblearn.pipeline import Pipeline as ImbPipeline

pipe = ImbPipeline(steps=[
    ('imp', Imputer()),
    ('enc', encoder),
    ('res', SMOTENC(random_state=11)),
    ...
])

param = [{'enc__onehotencoder__min_frequency': [0.0125, 0.025],
          'res__categorical_features': [DEPENDS ON ONEHOTENCODER MIN FREQUENCY]}]

gs = GridSearchCV(pipe, param)

res__categorical_features parameter depends on enc__onehotencoder__min_frequency - in my partucular case, categorical columns are all except the last two, but the number of columns after encoding depends on min_frequency.

So I want to set res__categorical_features dynamically. Is there a way to do this?

0

There are 0 best solutions below