# Feature selection before or after scaling and splitting

Should feature scaling/standardization/normalization be done before or after feature selection, and before or after data splitting?

I am confused about the order in which the various pre-processing steps should be done

• Yes; set the "min" and "max" statistic according to the training folds, then use that to transform both the training and test folds. (This is done in sklearn by using fit_transform on training folds and just transform on testing folds, and that's handled by all of the cross-validation methods.) May 2, 2022 at 16:16
• It depends on what method of the pipeline you call (see last comment for how cross-validation methods like cross_val_score or GridSearchCV will call the pipelin). See stackoverflow.com/a/68285130/10495893 for how the pipeline calls individual steps. May 2, 2022 at 16:26