K-Nearest Neighbor algorithm for classification
K-Nearest Neighbor algorithm for classification Data Science Project
Classification in Depth with Scikit-Learn

K-Nearest Neighbor algorithm for classification

This project will present the K-Nearest Neighbor algorithm, which is a popular machine learning technique used for classification and regression. We will cover relevant topics such as hyperparameters, splitting the data into training and testing datasets, and finally, we will attempt to predict the winner of the 2016 Presidential election (Trump vs. Clinton) in each county in the US.

Project Activities

All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.

All our activities include solutions with explanations on how they work and why we chose them.


Performance evaluation

What is accuracy of training and testing data?

Round to two decimal places


Test time versus train time

k-NN algorithm does more computation on test time rather than train time.


KNN uses

Which of the following option is true about KNN algorithm?



Which of the following statement is true about KNN algorithm ?


Decision Boundaries

The Figure below illustrates decision boundaries for two nearest-neighbour classifiers. Determine which one of the boundaries belongs to the 1-nearest neighbour classifier.


K-Nearest Neighbor algorithm for classificationK-Nearest Neighbor algorithm for classification

Verónica Barraza

This project is part of

Classification in Depth with Scikit-Learn

Explore other projects