How does the mean shift algorithm determine cluster centers without specifying k in advance?

Last updated 11 November 2026

  • Mean shift estimates the data density with a kernel density estimate and repeatedly moves each point to the kernel-weighted mean of its window, climbing to a local density peak (mode).

  • Points converging to the same mode form one cluster, so the number of clusters equals the number of modes.

  • The kernel bandwidth replaces k: small bandwidth gives many clusters, large gives few (estimate_bandwidth can choose it).

  • https://medium.com/@arko_sengupta/mean-shift-clustering-a-comprehensive-guide-520dea6a636f
  • https://arxiv.org/html/1503.00687v1
  • https://www.geeksforgeeks.org/machine-learning/ml-mean-shift-clustering/
All Clustering interview questions