Feature space

K-nearest neighbour regions

GreenRedTestBoundary
92.9%accuracy
G→G20
G→R1
R→G2
R→R19
0 manual
-8-8-6-6-4-4-2-20022446688feature x₁feature x₂
Query (0.00, 0.00)Green vote: 0/7 (0.0%)Red: 7Prediction: red

Query explores votes · Add modes create training points · Move repositions manual points · generated samples and manual points remain independent.

Test performance

Confusion matrix

92.9%accuracy
Rows are actual classes and columns are predicted classes. Percentages are joint probabilities over all test points.
Actual ↓ / Predicted → Green Red
GreenTP2047.6%FN12.4%
RedFP24.8%TN1945.2%

Green is the positive class · percentages sum to 100% of the test set.

Model selection

Accuracy versus K

92.9%K = 7
80%90%100%1K = 1: 90.5% accuracy3K = 3: 92.9% accuracy5K = 5: 92.9% accuracy7K = 7: 92.9% accuracy9K = 9: 92.9% accuracy11K = 11: 95.2% accuracy13K = 13: 92.9% accuracy15K = 15: 92.9% accuracy17K = 17: 92.9% accuracy19K = 19: 95.2% accuracy21K = 21: 95.2% accuracy23K = 23: 95.2% accuracy25K = 25: 95.2% accuracyneighbours K

Select a point to update K and the decision boundary.

K = 7 · majority voting Every neighbour contributes one equal vote.

Made by Alexandre Bernardino with Codex