[mlpack-git] [mlpack] Mean shift clustering (#388)
Ryan Curtin
notifications at github.com
Mon Jan 26 21:48:33 EST 2015
> + arma::Col<double> mhVector = newCentroid - allCentroids.col(i);
> +
> + // update the centroid.
> + allCentroids.col(i) = newCentroid;
> +
> + if (arma::norm(mhVector, 2) < stopThresh ||
> + completedIterations > maxIterations) {
> + break;
> + }
> +
> + }
> +
> + }
> +
> + // remove duplicate centroids.
> + for (size_t i = 0; i < allCentroids.n_cols; ++i) {
Why not check if there is a duplicate centroid once you finish finding the centroid for an individual point? If you refactor the code to only consider one centroid at a time and only add it to the results if it is not duplicated in the existing list of results, I think you will get faster (and more memory-efficient) code.
---
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/388/files#r23584017
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20150126/8b1368d0/attachment.html>
More information about the mlpack-git
mailing list