Syllabus Lesson 147 of 239 · Embeddings & Semantic Search from Scratch
Embeddings & Semantic Search from Scratch

Watch: K-means Clustering

You are about to use clustering to route and de-duplicate. First, see how the most common clustering algorithm, k-means, actually works. It has no answer key, just points, and it groups them by repeating two simple steps.

Press play. Watch it assign every point to its nearest centroid, then move each centroid to the average of its points, and repeat. Notice a stray point get grabbed by the wrong cluster on the first pass, then corrected on the next, that self-correction is the whole idea.

Spotted a problem in this lesson? Report it

Code · runs in your browser
Output