Primers • K-Nearest Neighbors (kNN)
code & cognition
0:00 / 0:00
Primers • K-Nearest Neighbors (kNN)
195 просмотров · 1 мес. назад
code & cognition
1,51 тыс. подписчиков
195 просмотров · 1 мес. назад
first video in a while, suffering from low blood platelets currently, apologies beforehand for any inconvenience
k-Nearest Neighbours.
This is Episode 01 of the basics-to-frontier series on this channel.
· Why kNN is supervised, non-parametric, lazy and instance-based
· The two phases: an empty training phase, and a four-step prediction phase
· Euclidean, Manhattan, Minkowski and Hamming distance , and the geometry of each
· How the choice of metric alone can change which point is "nearest"
· Choosing k: overfitting, underfitting, and cross-validation with real error curves
· Distance weighting, and when it actually changes the answer
· A complete worked example: four points, one query, k = 1, 3 and 4
· Seven ways to avoid committing to a fixed k, and what each one costs
· kNN vs k-means: same letter, completely different job
Everything numerical on screen is computed, not typed by hand — the decision
boundaries, the roughness percentages, the error-vs-k curves and the LOF scores
are all produced by the same code that renders the animation.
Animations built with Manim Community Edition.
Corrections and questions go in the comments; I read them.
knowledge should be open source.