ML 4.2Lesson outlineLesson 2 of 9 in Module 4
k-Nearest Neighbours
Classify a new point by a vote of its nearest neighbours, and see what K and the distance do to the boundary.
Video in production.
Lesson outline: k-Nearest Neighbours
In this lesson12 parts
- 01A diagnosis from similar cases
- 02Two standardized features
- 03The majority class
- 04The vote
- 05Nothing learned, two hyperparameters
- 06No loss to minimize
- 07Fitting stores the rows
- 08Predicting the hidden tumor
- 09Training accuracy
- 10What K and scale do
- 11Code
- 12Recap, your challenge, and what comes next
Builds on
This lesson stands on its own. These go deeper into what it uses.
Key terms: k-Nearest Neighbours
The words this lesson introduces, each in one line. The module’s glossary collects them all, and the AI glossary has every term across the courses.
- baseline (reminder, ML 1.1)
- Here, benign for every training tumour: 62.72%.
- k-nearest neighbors
- A classifier that predicts the majority label of the K nearest training rows.
- vote
- The count of each label among them.
- hyperparameter (reminder, ML 1.1)
- A choice made before fitting: here K and the distance.
- lazy learner
- A model that stores the training rows and does its work when it predicts.
- probabilistic label
- The fraction of the K neighbors with each label.
- tie
- Equal votes for two labels.
- weighted k-NN
- Votes weighted by one over distance.
- decision surface
- The predicted label at every point of the feature space.
- Voronoi cell
- The region nearest to one training row.
- k-NN regression
- Predicting the mean label of the K nearest rows.
Quiz: k-Nearest Neighbours
Your first pick on each question is the one that counts. Getting one wrong here is how the lesson sticks.