How does Mini-Batch K-Means update cluster centroids compared to standard batch K-Means?

Quick Overview

Asks how Mini-Batch K-Means updates its centroids and how that differs from the full-batch Lloyd update. Tests understanding of per-centroid learning rates, running means, the link to stochastic gradient descent, and the speed versus quality trade-offs of clustering at scale.

How does Mini-Batch K-Means update cluster centroids compared to standard batch K-Means?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How does Mini-Batch K-Means update cluster centroids compared to standard batch K-Means? Describe both update rules precisely enough that someone could implement them. ```hint Keep a mean incrementally Write the batch update as a mean over assigned points. Then ask how you would keep that mean up to date if the points arrived a few at a time and you could not store them. ``` ```hint Points counted long ago Think about a point that was counted toward a centroid in an early batch but would now be assigned to a different centroid. Ask whether each algorithm ever corrects for it. ``` ### What a Strong Answer Covers - The batch update rule and its cost per pass over the data - The mini-batch update, including how the step size is set for each centroid and why it shrinks - What a mini-batch centroid equals after many updates, and the connection to stochastic gradient descent - The practical trade-offs in speed, memory, final clustering quality and convergence behavior ### Follow-up Questions - Why does Mini-Batch K-Means usually finish with slightly higher inertia than Lloyd's algorithm on the same data? - How would you choose the batch size, and what goes wrong when it is very small? - What can go wrong with a centroid that receives very few points, and how would you handle it? - How would you change the update if the data distribution drifts over time?

Overview: Asks how Mini-Batch K-Means updates its centroids and how that differs from the full-batch Lloyd update. Tests understanding of per-centroid learning rates, running means, the link to stochastic gradient descent, and the speed versus quality trade-offs of clustering at scale.

General logo
General
Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

How does Mini-Batch K-Means update cluster centroids compared to standard batch K-Means? Describe both update rules precisely enough that someone could implement them.

What a Strong Answer Covers Guidance

  • The batch update rule and its cost per pass over the data
  • The mini-batch update, including how the step size is set for each centroid and why it shrinks
  • What a mini-batch centroid equals after many updates, and the connection to stochastic gradient descent
  • The practical trade-offs in speed, memory, final clustering quality and convergence behavior

Follow-up Questions Guidance

  • Why does Mini-Batch K-Means usually finish with slightly higher inertia than Lloyd's algorithm on the same data?
  • How would you choose the batch size, and what goes wrong when it is very small?
  • What can go wrong with a centroid that receives very few points, and how would you handle it?
  • How would you change the update if the data distribution drifts over time?