Reputation: 169
I'm trying to pass normalize
in parameter search to pass it to GridSearchCV.
I'm getting a warning that normalize is depreciated and that I should use StandardScalar instead.
I can't just add StandardScalar to the pipeline because that would apply it all the time when I want it to be applied once and not applied the second time.
This is my code:
'params': {
'normalize': [True, False]
}
How can I use StandardScalar
here instead of normalize
?
Upvotes: 0
Views: 109
Reputation: 66775
Just incorporate StandardScaler
into your pipeline, and control its parameters
class sklearn.preprocessing.StandardScaler(*, copy=True,
with_mean=True, with_std=True)
By setting with_mean=False
and with_std=False
you will get no normalisation, and setting both to true - you get whitening.
Quote from documentation:
The standard score of a sample x is calculated as:
z = (x - u) / s
where u is the mean of the training samples or zero if with_mean=False, and s is the standard deviation of the training samples or one if with_std=False.
Upvotes: 2