◒ MIDNIGHT ALGORITHMS

← All labs

Machine learning

K-Nearest Neighbors

KNN predicts a class by majority vote among the K closest labeled examples. Distance is Euclidean. Ties are resolved in favor of class A in this demonstration.

Try this

Try K = 1 and K = 9 for a point near the boundary. When does the prediction change?

Use the labeled controls with your mouse or keyboard. The output above summarizes the visualization.