4.1. Exercises
Classifying Examples by Hand
Consider this toy dataset:

Question 1
Question 2
π-NN Classifiers True or False
Predicting with a π-NN-Classifier
Instructions:
Running a coding exercise for the first time could take a bit of time for everything to load. Be patient, it could take a few minutes.
When you see ____ in a coding exercise, replace it with what you assume to be the correct code. Run it and see if you obtain the desired output. Submit your code to validate if you were correct.
Make sure you remove the hash (#) symbol in the coding portions of this question. We have commented them so that the line wonβt execute and you can test your code after each step.
Letβs try to classify some PokΓ©mon from the PokΓ©mon dataset. How well does our model do on the training data?
Tasks:
- Create a
KNeighborsClassifiermodel withn_neighborsequal to 5 and name itmodel. - Train your model on
X_trainandy_train(Hint: you may want to use.to_numpy()). - Score your model on the training set using
.score()and save it in an object namedtrain_score. - Score your model on the test set using
.score()and save it in an object namedtest_score.