from sklearn svm import svc x_trainx_testy_trainy_test train_test_split(cancer datacancer targetrandom_state= svm svc( = svm fit(x_trainy_trainprint("test set accuracy{ }format(svm score(x_testy_test))out[ ]test set accuracy nowlet' scale the data using minmaxscaler before fitting the svcin[ ]preprocessing using - scaling scaler minmaxscaler(scaler fit(x_trainx_train_scaled scaler transform(x_trainx_test_scaled scaler transform(x_testlearning an svm on the scaled training data svm fit(x_train_scaledy_trainscoring on the scaled test set print("scaled test set accuracy{ }formatsvm score(x_test_scaledy_test))out[ ]scaled test set accuracy as we saw beforethe effect of scaling the data is quite significant even though scaling the data doesn' involve any complicated mathit is good practice to use the scaling mechanisms provided by scikit-learn instead of reimplementing them yourselfas it' easy to make mistakes even in these simple computations you can also easily replace one preprocessing algorithm with another by changing the class you useas all of the preprocessing classes have the same interfaceconsisting of the fit and transform methodsin[ ]preprocessing using zero mean and unit variance scaling from sklearn preprocessing import standardscaler scaler standardscaler(scaler fit(x_trainx_train_scaled scaler transform(x_trainx_test_scaled scaler transform(x_testpreprocessing and scaling