13 #ifndef MLPACK_METHODS_MEAN_SHIFT_MEAN_SHIFT_HPP
14 #define MLPACK_METHODS_MEAN_SHIFT_MEAN_SHIFT_HPP
20 #include <boost/utility.hpp>
46 template<
bool UseKernel =
false,
48 typename MatType = arma::mat>
64 const size_t maxIterations = 1000,
65 const KernelType kernel = KernelType());
73 double EstimateRadius(
const MatType& data,
const double ratio = 0.2);
84 void Cluster(
const MatType& data,
85 arma::Col<size_t>& assignments,
87 bool useSeeds =
true);
95 double Radius()
const {
return radius; }
97 void Radius(
double radius);
100 const KernelType&
Kernel()
const {
return kernel; }
118 void GenSeeds(
const MatType& data,
119 const double binSize,
131 template<
bool ApplyKernel = UseKernel>
132 typename std::enable_if<ApplyKernel, bool>::type
133 CalculateCentroid(
const MatType& data,
134 const std::vector<size_t>& neighbors,
135 const std::vector<double>& distances,
136 arma::colvec& centroid);
146 template<
bool ApplyKernel = UseKernel>
147 typename std::enable_if<!ApplyKernel, bool>::type
148 CalculateCentroid(
const MatType& data,
149 const std::vector<size_t>& neighbors,
150 const std::vector<double>&,
151 arma::colvec& centroid);
161 size_t maxIterations;
171 #include "mean_shift_impl.hpp"
173 #endif // MLPACK_METHODS_MEAN_SHIFT_MEAN_SHIFT_HPP
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t & MaxIterations()
Set the maximum number of iterations.
This class implements mean shift clustering.
double EstimateRadius(const MatType &data, const double ratio=0.2)
Give an estimation of radius based on given dataset.
MeanShift(const double radius=0, const size_t maxIterations=1000, const KernelType kernel=KernelType())
Create a mean shift object and set the parameters which mean shift will be run with.
size_t MaxIterations() const
Get the maximum number of iterations.
void Cluster(const MatType &data, arma::Col< size_t > &assignments, arma::mat ¢roids, bool useSeeds=true)
Perform mean shift clustering on the data, returning a list of cluster assignments and centroids...
const KernelType & Kernel() const
Get the kernel.
The standard Gaussian kernel.
KernelType & Kernel()
Modify the kernel.
double Radius() const
Get the radius.