1. Learn
  2. /
  3. Courses
  4. /
  5. Preprocessing for Machine Learning in Python

Exercise

KNN on scaled data

The accuracy score on the unscaled wine dataset was decent, but let's see what you can achieve by using standardization. Once again, the knn model as well as the X and y data and labels set have already been created for you.

Instructions

100 XP
  • Create the StandardScaler() method, stored in a variable named scaler.
  • Scale the training and test features, being careful not to introduce data leakage.
  • Fit the knn model to the scaled training data.
  • Evaluate the model's performance by computing the test set accuracy.