Expand description
k-nearest-neighbours classification.
See the book entry k-nearest neighbours.
Structs§
- KNearest
Neighbors - Classifies a point by a vote among its
kclosest training points (Euclidean distance). The model is “lazy”: fitting just stores the data. Withdistance_weightedeach neighbour’s vote counts1/distanceso nearer points matter more (an exact match decides alone). Prediction is brute force,O(n·d)per query; use a k-d tree from the geometry crate for large 2D/3D sets.