What is the correct way to apply sklearn's StandardScaler inside a cross-validation loop to avoid data leakage?
-
A
Fit the scaler on all data before splitting folds
-
B
Include the scaler in a Pipeline and pass the pipeline to cross_validate
-
C
Fit and transform both train and test folds together
-
D
Fit the scaler on test data and apply it to train data