AI Literacy — K-Nearest Neighbor

Monster Classifier

Enter a monster's features and the app will walk you through the complete K-Nearest Neighbor analysis — step by step — using the 20-monster training dataset.

Step 1 of 5
Describe your monster
KMONST  ·  This classifier runs against a fixed pre-trained dataset of 20 monsters sorted into 3 clusters by the K-Means algorithm. Any monster you enter will be classified against that training set — and only that training set. If your monster is very different from anything in KMONST, the result may be ambiguous or unreliable.

Use the controls below to enter your monster's six features. Sliders set count values; buttons toggle yes/no features. When you're ready, click Center the data to begin the analysis.

Step 2 of 5
Center the data

Before we can compare your monster to the training monsters, we need to center its feature values. We subtract the training dataset's average from each feature. A positive centered value means your monster is above average for that feature; a negative value means below average. This puts your monster into the same coordinate language as the 20 training monsters.

Feature Your value Training average Centered (your − avg)

These six centered values form your monster's centered feature vector — the input to the PCA projection in the next step.

Step 3 of 5
Project to the map

The 20 training monsters live on a 2D map built by Principal Component Analysis (PCA), which compresses 6 features into 2 coordinates so everything can be plotted on a graph. We project your monster onto the same map using two weighted-sum formulas — one for X (PC1) and one for Y (PC2).

PC1 (X-axis) is dominated by Warmth — warmer monsters land further left. PC2 (Y-axis) is dominated by Teeth count — toothier monsters land higher up.

Your monster appears as ★ YOU on the map. Blue = Cluster 0, amber = Cluster 1, red = Cluster 2.

Step 4 of 5
Find the nearest neighbors

We measure the Euclidean distance (straight-line distance on the map) from your monster to each of the 20 training monsters — the same measurement a student makes with a ruler on a printed graph. The table below shows all 20, sorted closest to farthest. The top five are your neighbors for K = 3, 4, and 5. Lines on the map show those distances.

Rank Monster Cluster Distance Used at K =
Step 5 of 5
The K-Nearest Neighbor vote

Your nearest neighbors vote on which cluster your monster belongs to. We run the vote at K = 3, K = 4, and K = 5 and compare. If all three agree, the result is stable. If they disagree, the case is ambiguous and a human must decide.