new data (sayin form of our test set)this data will not have been used to scale the training dataand it might have different minimum and maximum than the training data the following example (figure - shows how the data processing during cross-validation and the final evaluation differin[ ]mglearn plots plot_improper_processing(figure - data usage when preprocessing outside the cross-validation loop sothe splits in the cross-validation no longer correctly mirror how new data will look to the modeling process we already leaked information from these parts of the data into our modeling process this will lead to overly optimistic results during cross-validationand possibly the selection of suboptimal parameters to get around this problemthe splitting of the dataset during cross-validation should be done before doing any preprocessing any process that extracts knowledge from the dataset should only ever be applied to the training portion of the datasetso any cross-validation should be the "outermost loopin your processing to achieve this in scikit-learn with the cross_val_score function and the grid searchcv functionwe can use the pipeline class the pipeline class is class that allows "gluingtogether multiple processing steps into single scikit-learn estimaparameter selection with preprocessing