mini-module no-code try-without-ai ml-fundamentals ~30 min

Birds of a Feather Gleich und Gleich gesellt sich gern

Birds of a feather flock together. K-Nearest Neighbours turns that proverb into an algorithm. Gleich und Gleich gesellt sich gern. K-Nächste-Nachbarn macht dieses Sprichwort zum Algorithmus.

Tom Gauld: Our Blessed Homeland vs Their Barbarous Wastes
Cartoon by Tom Gauld, Cartoon von Tom Gauld: reddit.com/r/funny/comments/2xljaz
Ministry of Territorial Affairs Ministerium für Territorialfragen Year 1 A.K. (After K-NN)

Blobovia vsgegen Splotchia

The ancient and glorious nation of BLOBOVIA, blessed with noble populace, heroic adventurers, and a glorious leader, has long endured the proximity of SPLOTCHIA, a barbarous waste governed by a wicked despot and populated by brutish invaders.

Die uralte und ruhmreiche Nation BLOBOVIEN ist gesegnet mit edler Bevölkerung, heldenhaften Abenteurern und einem glorreichen Anführer. Seit jeher erträgt sie die Nachbarschaft von SPLOTSCHIEN, einer barbarischen Wüstenei. Dort herrscht ein ruchloser Despot über rohe Eindringlinge.

The contested borderlands shall be decided not by cannon nor sword, but by the sacred algorithm of K-Nearest Neighbours: a village belongs to whichever nation has the most settlements nearby. Place your dots. The land remembers its neighbours.

Über die umstrittenen Grenzgebiete entscheiden weder Kanonen noch Schwerter. Es entscheidet der heilige Algorithmus der K-Nächsten-Nachbarn. Ein Dorf gehört der Nation mit den meisten Siedlungen in der Nähe. Setz deine Punkte. Das Land erinnert sich an seine Nachbarn.

Each side receives 5 founding settlements, placed at random by the cartographers' office. Then 10 moves to claim territory. The dot you place will fly the flag of whichever nation the classifier assigns to that location.

Jede Seite erhält 5 Gründungssiedlungen, zufällig vom Kartenamt platziert. Dann folgen 10 Züge, um Gebiet zu beanspruchen. Der Punkt, den du setzt, zeigt die Flagge der Nation, die der Klassifikator für diesen Ort bestimmt.

CLASSIFIED

How K-NN works Wie K-NN funktioniert

K-Nearest Neighbours is one of the oldest and most intuitive ideas in machine learning. It makes no assumptions about the shape of the world. It stores no trained weights. It simply asks: what are my neighbours doing?

K-Nächste-Nachbarn ist eine der ältesten und einfachsten Ideen im maschinellen Lernen. Der Algorithmus macht keine Annahmen über die Struktur der Daten. Er fragt nur: Was machen meine Nachbarn?

"Tell me who your neighbours are, and I will tell you who you are." „Sag mir, wer deine Nachbarn sind, und ich sage dir, wer du bist.“ , folk proverb, adapted for machine learning Sprichwort, für das maschinelle Lernen abgewandelt
1
Training dataTrainingsdaten You have a collection of labelled examples, dots on a map, each coloured by its nation. K-NN stores them all. No learning step required. The entire dataset is the model. Du hast eine Sammlung beschrifteter Beispiele: Punkte auf einer Karte, jeder in der Farbe seiner Nation. K-NN speichert sie alle. Ein Lernschritt ist nicht nötig. Der gesamte Datensatz ist das Modell.
2
Find the K nearestK Nächste finden A new unknown point arrives. Measure its distance to every labelled point. Keep the K closest ones. K is the one number you choose, it controls how much neighbourhood context influences the result. Ein neuer, unbekannter Punkt kommt hinzu. Miss seinen Abstand zu jedem beschrifteten Punkt. Behalte die K nächsten. K ist die einzige Zahl, die du wählst. Sie steuert, wie viel Umgebung in das Ergebnis einfließt.
3
Majority voteMehrheitsvotum Among those K neighbours, count the labels. Whichever class appears most often wins. The new point is assigned that label. That is the entire algorithm. No formulas beyond counting and distance. Unter diesen K Nachbarn werden die Beschriftungen gezählt. Die häufigste Klasse gewinnt. Der neue Punkt bekommt diese Beschriftung. Das ist der ganze Algorithmus.
4
The decision boundaryDie Entscheidungsgrenze Apply K-NN to every empty point in the space and you get a territory map, regions where each class dominates. The boundary is not drawn explicitly. It emerges from the data. Change K, and the entire border shifts. Wende K-NN auf jeden leeren Punkt im Raum an, und du bekommst eine Gebietskarte. Sie zeigt, wo welche Klasse dominiert. Niemand zeichnet die Grenze ein, sie entsteht aus den Daten. Änderst du K, verschiebt sich die ganze Grenze.
Interactive demo, click to add points, watch the territory update Interaktive Demo: klicken, um Punkte hinzuzufügen
3
Try: place a cluster of Blobovia dots, then surround it with Splotchia. Change K from 1 to 9 and watch the border smooth out. Probier es aus: Setz einen Cluster aus Blobovien-Punkten und umgib ihn mit Splotschien. Ändere K von 1 auf 9 und schau zu, wie die Grenze glatter wird.

Distance geometry Abstandsgeometrie

"Nearest" depends on how you measure. Three different rulers produce three different territory maps from the same dots. Click a card to switch, the demo and the game update immediately.

„Nächste“ hängt davon ab, wie du misst. Drei verschiedene Maßstäbe erzeugen aus denselben Punkten drei verschiedene Karten. Klick auf eine Karte, um zu wechseln. Demo und Spiel passen sich sofort an.

Euclidean
√(Δx² + Δy²)
Straight-line distance, as the crow flies. Produces smooth circular decision boundaries. The natural shape of influence spreading evenly in all directions.
Abstand in Luftlinie. Erzeugt glatte, kreisförmige Entscheidungsgrenzen. Das ist die natürliche Form, wenn sich Einfluss in alle Richtungen gleich ausbreitet.
Manhattan
|Δx| + |Δy|
City-block distance, only along axes, no diagonals. Named after the NYC street grid. Equidistant points form a diamond. Borders look angular and grid-aligned.
Häuserblock-Abstand, nur entlang der Achsen und ohne Diagonalen. Benannt nach dem Straßenraster von New York. Gleich weit entfernte Punkte bilden eine Raute. Die Grenzen wirken eckig und am Raster ausgerichtet.
Chebyshev
max(|Δx|, |Δy|)
Chess-king distance, diagonal and straight moves cost the same. A king reaches any adjacent square in exactly one move. Produces square decision boundaries.
Schachkönig-Abstand: diagonale und gerade Züge kosten gleich viel. Ein König erreicht jedes Nachbarfeld in genau einem Zug. Das erzeugt quadratische Entscheidungsgrenzen.

The game, claim your territory Das Spiel: beanspruche dein Gebiet

Five founding settlements per side, placed randomly by the cartographers' office. Then ten moves total, five per player. When you place a dot, K-NN immediately classifies it: the dot flies the flag of whichever nation controls that location in the current model. Your goal is to control the most territory when the moves run out.

Fünf Gründungssiedlungen pro Seite, zufällig vom Kartenamt platziert. Dann zehn Züge insgesamt, also fünf pro Spielerin. Setzt du einen Punkt, klassifiziert K-NN ihn sofort. Der Punkt zeigt dann die Flagge der Nation, die diesen Ort im aktuellen Modell kontrolliert. Dein Ziel: am Ende das meiste Gebiet kontrollieren.

Blobovia's turnBloboviens Zug

Territory scoresGebietsstand
Blobovia
0
Splotchia
0
Moves leftZüge übrig
10
K
3 (odd = no ties)(ungerade = keine Gleichstände)