CommencerCommencer gratuitement

Training a model with PCA

Now that you have run PCA on the wine dataset, you'll finally train a KNN model using the transformed data.

Cet exercice fait partie du cours

Preprocessing for Machine Learning in Python

Afficher le cours

Instructions

  • Fit the knn model to the PCA-transformed features, pca_X_train, and training labels, y_train.
  • Print the test set accuracy of the knn model using pca_X_test and y_test.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Fit knn to the training data
____

# Score knn on the test data and print it out
____
Modifier et exécuter le code