[mlpack-git] [mlpack] Mean shift clustering (#388)

Ryan Curtin notifications at github.com
Tue Jan 27 08:49:52 EST 2015


> + * For each point in dataset, apply mean shift algorithm until maximum 
> + * iterations or convergence. 
> + * Then remove duplicate centroids.
> + * 
> + * A simple example of how to run Mean Shift clustering is shown below.
> + *
> + * @code
> + * extern arma::mat data; // Dataset we want to run Mean Shift on.
> + * arma::Col<size_t> assignments; // Cluster assignments.
> + * arma::mat centroids; // Cluster centroids.
> + *
> + * MeanShift<arma::mat, kernel::GaussianKernel> meanShift();
> + * meanShift.Cluster(dataset, assignments, centroids);
> + * @endcode
> + *
> + * @tparam KernelType the kernel to use.

I thought about this a little more, and there's actually no need for type traits.  Translation invariant kernels can simply provide `double Evaluate(const double distance)`, so you might use this in the wild like:

```
// assume we have 'metric' and 'kernel'
const double k = kernel.Evaluate(metric.Evaluate(dataset.col(i), dataset.col(j)));
```

This also forces a radial basis kernel of some sort, so there's no need to worry about re-deriving mean shift for the non-radial kernel case.

---
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/388/files#r23608241
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20150127/c362dfad/attachment.html>


More information about the mlpack-git mailing list