circles and the test set shown as triangles the second panel is the same databut scaled using the minmaxscaler herewe called fit on the training setand then called transform on the training and test sets you can see that the dataset in the second panel looks identical to the firstonly the ticks on the axes have changed now all the features are between and you can also see that the minimum and maximum feature values for the test data (the trianglesare not and the third panel shows what would happen if we scaled the training set and test set separately in this casethe minimum and maximum feature values for both the training and the test set are and but now the dataset looks different the test points moved incongruously to the training setas they were scaled differently we changed the arrangement of the data in an arbitrary way clearly this is not what we want to do as another way to think about thisimagine your test set is single point there is no way to scale single point correctlyto fulfill the minimum and maximum requirements of the minmaxscaler but the size of your test set should not change your processing shortcuts and efficient alternatives oftenyou want to fit model on some datasetand then transform it this is very common taskwhich can often be computed more efficiently than by simply calling fit and then transform for this use caseall models that have transform method also have fit_transform method here is an example using standardscalerin[ ]from sklearn preprocessing import standardscaler scaler standardscaler(calling fit and transform in sequence (using method chainingx_scaled scaler fit(xtransform(xsame resultbut more efficient computation x_scaled_d scaler fit_transform(xwhile fit_transform is not necessarily more efficient for all modelsit is still good practice to use this method when trying to transform the training set the effect of preprocessing on supervised learning now let' go back to the cancer dataset and see the effect of using the minmaxscaler on learning the svc (this is different way of doing the same scaling we did in chapter firstlet' fit the svc on the original data again for comparison unsupervised learning and preprocessing