WeCodeAcademy

Clustering with k-Means

So far we had answers to learn from (supervised learning). With unsupervised learning there are no labels and the model looks for structure on its own. k-means groups points into k clusters around centres. The cluster numbers are arbitrary (0 and 1 could be swapped), so look at the groups, not the numbers.

Examplepython
Open in editor »
Quick check

What is different about unsupervised learning?

Your turn: write the code

Cluster the points into 3 groups and print the sorted group sizes.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.