k-nearest neighbours
k-nearest neighbours does not learn a line at all. it keeps every point, and to label a new spot it finds the k closest ones and lets them vote. the shading is that vote, asked at every spot on the plot.
try this
- set k to 1. every stray point gets an island of its own, because the nearest point to it is itself.
- slide k up to 15. the islands are gone and the boundary smooths into one sweep, since each vote now takes in most of the points.
- under more, switch to manhattan and set k back to 1. distance now runs along the grid, so the islands turn blocky.