Lecture 6 · Interactive explanation
Count predictions; then discover groups
These are two different tasks. Classification has supplied labels to check against. Clustering forms groups without being given the answers.
1. A confusion matrix
Take injured as positive. Enter test-set counts. Precision starts with positive predictions; recall starts with actual positives.
If a denominator is zero, the corresponding metric is undefined here. Software sometimes assigns a convention instead; check which convention is used.
2. k-means, one iteration at a time
These are invented points in two features measured on a comparable scale. Coloured dots are assignments; large markers are centroids.
k is chosen by you here, not proved by the algorithm. Lower within-cluster error as k grows does not prove more meaningful groups. PCA is another unsupervised operation: its axes retain variance; they do not supply class labels.