Skip to content
StackDecode
AI & ML Atlas
Machine LearningalgorithmInteractive simulation

Mean Shift Clustering

Moves every point uphill to the nearest density peak.

The idea

Place a window (kernel) around each point and move the window to the mean of the points inside it. Repeating this climbs toward a local density peak (a mode). Points that climb to the same peak form a cluster. The bandwidth controls how many peaks you find; you do not choose k.

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

  • data
  • window

Place a window on many points. Each window will climb toward the densest nearby spot.

1/10

A bigger radius merges nearby peaks; a smaller one splits them.

Step by step

  1. 1Choose a bandwidth.
  2. 2For each point, compute the mean of the points within the bandwidth.
  3. 3Shift the point to that mean.
  4. 4Repeat until shifts become tiny.
  5. 5Merge points that ended at the same mode.

Where it is used

Image segmentation, object tracking.

Watch out for

Slow for large data and sensitive to the bandwidth.

Related