Each point is a simulated patient positioned by three normalized
features (e.g. age, biomarker level, symptom score). K-means starts
with k random centroids, assigns every point to its nearest centroid,
then moves each centroid to the mean of its assigned points — repeated
until the centroids stop moving.
assign: cluster(i) = argmin_c ||x_i − centroid_c||²
update: centroid_c = mean({x_i : cluster(i) = c})
repeat until centroids converge
- Sample size — how many simulated patient records are plotted.
- Feature weighting — how strongly the underlying risk factor separates the data into distinguishable groups.
- Cluster count (k) — how many risk groups the algorithm tries to find; picking k badly under- or over-splits real structure.
This is a genuine unsupervised learning technique used in real
healthcare analytics to surface patient risk segments — cohorts a
clinician can then investigate — directly from raw records, without
needing labelled outcomes in advance.