13 #ifndef MLPACK_METHODS_MEAN_SHIFT_MEAN_SHIFT_HPP 14 #define MLPACK_METHODS_MEAN_SHIFT_MEAN_SHIFT_HPP 47 template<
bool UseKernel =
false,
49 typename MatType = arma::mat>
65 const size_t maxIterations = 1000,
66 const KernelType kernel = KernelType());
74 double EstimateRadius(
const MatType& data,
const double ratio = 0.2);
88 void Cluster(
const MatType& data,
89 arma::Row<size_t>& assignments,
91 bool forceConvergence =
true,
92 bool useSeeds =
true);
102 void Radius(
double radius);
105 const KernelType&
Kernel()
const {
return kernel; }
123 void GenSeeds(
const MatType& data,
124 const double binSize,
136 template<
bool ApplyKernel = UseKernel>
137 typename std::enable_if<ApplyKernel, bool>::type
138 CalculateCentroid(
const MatType& data,
139 const std::vector<size_t>& neighbors,
140 const std::vector<double>& distances,
141 arma::colvec& centroid);
151 template<
bool ApplyKernel = UseKernel>
152 typename std::enable_if<!ApplyKernel, bool>::type
153 CalculateCentroid(
const MatType& data,
154 const std::vector<size_t>& neighbors,
155 const std::vector<double>&,
156 arma::colvec& centroid);
166 size_t maxIterations;
176 #include "mean_shift_impl.hpp" 178 #endif // MLPACK_METHODS_MEAN_SHIFT_MEAN_SHIFT_HPP
Linear algebra utility functions, generally performed on matrices or vectors.
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.
size_t MaxIterations() const
Get the maximum number of iterations.
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.
void Cluster(const MatType &data, arma::Row< size_t > &assignments, arma::mat ¢roids, bool forceConvergence=true, bool useSeeds=true)
Perform mean shift clustering on the data, returning a list of cluster assignments and centroids...
The standard Gaussian kernel.
KernelType & Kernel()
Modify the kernel.
double Radius() const
Get the radius.
const KernelType & Kernel() const
Get the kernel.