_index.org

SU-CS229 OCT132025

Last edited: October 10, 2025

Key Sequence

Notation

New Concepts

Important Results / Claims

Questions

Interesting Factoids

SU-CS229 OCT202025

Last edited: October 10, 2025

Key Sequence

Notation

New Concepts

Important Results / Claims

Questions

Interesting Factoids

density estimation

Last edited: October 10, 2025

k-means clustering

Last edited: October 10, 2025

constituents

  • dataset \(\qty {x^{(1)}, \dots, x^{(n)}}\)
  • number of clusters \(k\)

requirements

Initialize cluster centroids \(\mu_{1}, …, \mu_{k}\) randomly, and repeat:

  • assigning points \(x^{(i)}\) to cluster centers \(c^{(i)}\): for each \(i \in [1, \dots N]\), write \(c^{(i)} = \arg\min_{j} \norm{x^{(i)}- \mu_{j}}^{2}_{2}\)
  • update centroids: for each \(j \in [1 \dots k]\), write \(\mu_{j} = \frac{\sum_{i=1}^{n} \mathbbm{1}\qty {c^{(i)}=j} x^{(i)}}{\sum_{i=1}^{n} \mathbbm{1}\qty {c^{(i)}=j}}\)

additional information

some ways to pick better centroid

  • sample the data points as the initial centroids
  • k-means++

k-means++

  • pick uniform data point to be first centroid
  • pick next centroid w.r.t. probability proportional to distance to the previous centroid squared

distortion function

Consider the following function:

Kaplan et al., 2020

Last edited: October 10, 2025

OG scaling laws paper