@@ -392,22 +392,36 @@ for centroids to be the mean of the points within a given region. These
392
392
candidates are then filtered in a post-processing stage to eliminate
393
393
near-duplicates to form the final set of centroids.
394
394
395
- Given a candidate centroid :math: `x_i` for iteration :math: `t`, the candidate
395
+ The position of centroid candidates is iteratively adjusted using a technique called hill
396
+ climbing, which finds local maxima of the estimated probability density.
397
+ Given a candidate centroid :math: `x` for iteration :math: `t`, the candidate
396
398
is updated according to the following equation:
397
399
398
400
.. math ::
399
401
400
- x_i ^{t+1 } = m(x_i ^t)
402
+ x ^{t+1 } = x^t + m(x ^t)
401
403
402
- Where :math: `N(x_i)` is the neighborhood of samples within a given distance
403
- around :math: `x_i` and :math: `m` is the *mean shift * vector that is computed for each
404
+ Where :math: `m` is the *mean shift * vector that is computed for each
404
405
centroid that points towards a region of the maximum increase in the density of points.
405
- This is computed using the following equation, effectively updating a centroid
406
- to be the mean of the samples within its neighborhood:
406
+ To compute :math: `m` we define :math: `N(x)` as the neighborhood of samples within
407
+ a given distance around :math: `x`. Then :math: `m` is computed using the following
408
+ equation, effectively updating a centroid to be the mean of the samples within
409
+ its neighborhood:
407
410
408
411
.. math ::
409
412
410
- m(x_i) = \frac {\sum _{x_j \in N(x_i)}K(x_j - x_i)x_j}{\sum _{x_j \in N(x_i)}K(x_j - x_i)}
413
+ m(x) = \frac {1 }{|N(x)|} \sum _{x_j \in N(x)}x_j - x
414
+
415
+ In general, the equation for :math: `m` depends on a kernel used for density estimation.
416
+ The generic formula is:
417
+
418
+ .. math ::
419
+
420
+ m(x) = \frac {\sum _{x_j \in N(x)}K(x_j - x)x_j}{\sum _{x_j \in N(x)}K(x_j - x)} - x
421
+
422
+ In our implementation, :math: `K(x)` is equal to 1 if :math: `x` is small enough and is
423
+ equal to 0 otherwise. Effectively :math: `K(y - x)` indicates whether :math: `y` is in
424
+ the neighborhood of :math: `x`.
411
425
412
426
The algorithm automatically sets the number of clusters, instead of relying on a
413
427
parameter ``bandwidth ``, which dictates the size of the region to search through.
0 commit comments