# Nearest Neighbors

Nearest Neighbors: Distance Between Examples, Nearest Neighbors.

Updated: November 19, 2026

1. [Distance Between Examples](https://www.ask-codey.com/lessons/ml-distance-between-examples) (Apprentice): Two examples become points when each feature is a direction, the straight-line (Euclidean) distance between them comes from the Pythagorean theorem and math.dist works it out for any number of features, and a feature measured in big units, like grams, swamps one scored from 0 to 10 until the features are put on a common scale.
2. [Nearest Neighbors](https://www.ask-codey.com/lessons/ml-nearest-neighbors) (Journeyman): A nearest neighbors classifier guesses a new example's class by finding the k training examples closest to it and letting them vote, with KNeighborsClassifier(n_neighbors=5) storing the training rows instead of learning a rule, a small k following every quirk, a large k blurring the classes together, and a tied vote, which in the lesson's run went to the class listed first.

Source: https://www.ask-codey.com/courses/machine-learning-python/topics/ml-nearest-neighbors-topic
