Jun-06-2020, 11:01 PM
(Jun-05-2020, 06:08 AM)dervast Wrote: Can we have a pre-step on the filtering and data scaling?Yes, we can! If you look at the example, it includes
StandardScaler
as a step in the pipeline. StandardScaler
has its own set of kwargs, e.g. with_mean
, with_std
.So, you can organize
pgrid
pgrid = { 'scaler__with_mean': [True, False], 'svc__C': [1, 10], }and use all of this in
GridSearchCV
. Thus, data scaling step is incorporated into one model. Finally,
GridSearchCV
allows to find best combination of parameters that influence not onlyclassification step, but preprocessing (scaling) too. Nothing prevents you to do the same thing for data filtering. Define
FilterData
class (you can use the source code of StandardScaler
as example) and incorporate it into a pipeline.