13 #ifndef MLPACK_METHODS_MEAN_SHIFT_MEAN_SHIFT_HPP 14 #define MLPACK_METHODS_MEAN_SHIFT_MEAN_SHIFT_HPP 20 #include <boost/utility.hpp> 48 template<
bool UseKernel =
false,
50 typename MatType = arma::mat>
66 const size_t maxIterations = 1000,
67 const KernelType kernel = KernelType());
75 double EstimateRadius(
const MatType& data,
const double ratio = 0.2);
89 void Cluster(
const MatType& data,
90 arma::Row<size_t>& assignments,
92 bool forceConvergence =
true,
93 bool useSeeds =
true);
103 void Radius(
double radius);
106 const KernelType&
Kernel()
const {
return kernel; }
124 void GenSeeds(
const MatType& data,
125 const double binSize,
137 template<
bool ApplyKernel = UseKernel>
138 typename std::enable_if<ApplyKernel, bool>::type
139 CalculateCentroid(
const MatType& data,
140 const std::vector<size_t>& neighbors,
141 const std::vector<double>& distances,
142 arma::colvec& centroid);
152 template<
bool ApplyKernel = UseKernel>
153 typename std::enable_if<!ApplyKernel, bool>::type
154 CalculateCentroid(
const MatType& data,
155 const std::vector<size_t>& neighbors,
156 const std::vector<double>&,
157 arma::colvec& centroid);
167 size_t maxIterations;
177 #include "mean_shift_impl.hpp" 179 #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.