In mini-batch k-means (Sculley's version) each centre c has a count v of points it has absorbed. For each point x assigned to it, the update is v←v+1, c←(1−η)c+ηx with η=1/v. In 1-D the centres are c1=4 with v1=3 and c2=10 with v2=1. A mini-batch {6,2,9,12} arrives. What are the new centres, and why does this update make sense?

Unsupervised learning, Mini-batch k-means
Level L2 Elementary. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can apply the per-centre learning rate and see that it keeps a running average.

Key idea

With η=1/v the update c←c+1v(x−c) is exactly the incremental formula for the mean of all v points seen by that centre. So the learning rate decays like 1/v and the centres settle down.

Steps

  1. Assign each batch point to its nearest centre first. The point 6 is at distance 2 from c1 and 4 from c2, so it goes to centre 1. The point 2 goes to centre 1 (distance 2 against 8). The point 9 goes to centre 2 (distance 1 against 5), and 12 goes to centre 2.
  2. Centre 1, point 6: v1=4, η=1/4, c1=4+14(6−4)=4.5.
  3. Centre 1, point 2: v1=5, η=1/5, c1=4.5+15(2−4.5)=4.0.
  4. Centre 2, point 9: v2=2, η=1/2, c2=10+12(9−10)=9.5. Then point 12: v2=3, η=1/3, c2=9.5+13(12−9.5)=10.33.
  5. Check with means. Centre 1 has absorbed three old points averaging 4, plus 6 and 2, so its mean is (12+6+2)/5=4. Centre 2 has (10+9+12)/3=10.33. The updates match.
  6. Explain why it is useful: each iteration touches only a small batch, so the cost per step is O(bkd) instead of O(nkd). The 1/v rate averages out noise from the random batches.

Common mistakes

How long your answer should be

About 5 short lines of arithmetic plus two sentences of explanation.

Last checked on 4 December 2026.

Read this

Previous in Unsupervised learning: Six records have three categorical attributes: 1=(a,x,p), 2=(a,x,q), 3=(a,y,p), 4=(b,y,q), 5=(b,y,p), 6=(b,x,q). Run k-modes with k=2 from initial modes c1=(a,x,p) and c2=(b,y,q), using the simple matching dissimilarity. What are the clusters, the new modes and the total cost?
Next in Unsupervised learning: Take the 1-D points {1,2,3,10,11,25} with k=2 and absolute-difference distance. Starting from medoids {1,11}, compute the total cost, then the cost after swapping medoid 1 with the non-medoid 2. Does PAM accept the swap, and is {2,11} optimal?