=mglearn cm ( )label="training set" = axes[ scatter(x_test[: ]x_test[: ]marker='^' =mglearn cm ( )label="test set" = axes[ legend(loc='upper left'axes[ set_title("original data"scale the data using minmaxscaler scaler minmaxscaler(scaler fit(x_trainx_train_scaled scaler transform(x_trainx_test_scaled scaler transform(x_testvisualize the properly scaled data axes[ scatter(x_train_scaled[: ]x_train_scaled[: ] =mglearn cm ( )label="training set" = axes[ scatter(x_test_scaled[: ]x_test_scaled[: ]marker='^' =mglearn cm ( )label="test set" = axes[ set_title("scaled data"rescale the test set separately so test set min is and test set max is do not do thisfor illustration purposes only test_scaler minmaxscaler(test_scaler fit(x_testx_test_scaled_badly test_scaler transform(x_testvisualize wrongly scaled data axes[ scatter(x_train_scaled[: ]x_train_scaled[: ] =mglearn cm ( )label="training set" = axes[ scatter(x_test_scaled_badly[: ]x_test_scaled_badly[: ]marker='^' =mglearn cm ( )label="test set" = axes[ set_title("improperly scaled data"for ax in axesax set_xlabel("feature "ax set_ylabel("feature "figure - effect of scaling training and test data shown on the left together (centerand separately (rightpreprocessing and scaling