mlpack 3.4.2
|
This class implements mean shift clustering. More...
#include <mean_shift.hpp>
Public Member Functions | |
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. More... | |
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. More... | |
double | EstimateRadius (const MatType &data, const double ratio=0.2) |
Give an estimation of radius based on given dataset. More... | |
KernelType & | Kernel () |
Modify the kernel. More... | |
const KernelType & | Kernel () const |
Get the kernel. More... | |
size_t & | MaxIterations () |
Set the maximum number of iterations. More... | |
size_t | MaxIterations () const |
Get the maximum number of iterations. More... | |
double | Radius () const |
Get the radius. More... | |
void | Radius (double radius) |
Set the radius. More... | |
This class implements mean shift clustering.
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.
UseKernel | Use kernel or mean to calculate new centroid. If false, KernelType will be ignored. |
KernelType | The kernel to use. |
MatType | The type of matrix the data is stored in. |
Definition at line 51 of file mean_shift.hpp.
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.
radius | If distance of two centroids is less than it, one will be removed. If this value isn't positive, an estimation will be given when clustering. |
maxIterations | Maximum number of iterations allowed before giving up iterations will terminate. |
kernel | Optional KernelType object. |
void Cluster | ( | const MatType & | data, |
arma::Row< size_t > & | assignments, | ||
arma::mat & | centroids, | ||
bool | forceConvergence = true , |
||
bool | useSeeds = true |
||
) |
Perform mean shift clustering on the data, returning a list of cluster assignments and centroids.
MatType | Type of matrix. |
data | Dataset to cluster. |
assignments | Vector to store cluster assignments in. |
centroids | Matrix in which centroids are stored. |
forceConvergence | Flag whether to force each centroid seed to converge regardless of maxIterations. |
useSeeds | Set true to use seeds. |
double EstimateRadius | ( | const MatType & | data, |
const double | ratio = 0.2 |
||
) |
Give an estimation of radius based on given dataset.
data | Dataset for estimation. |
ratio | Percentage of dataset to use for nearest neighbor search. |
|
inline |
Modify the kernel.
Definition at line 108 of file mean_shift.hpp.
|
inline |
Get the kernel.
Definition at line 106 of file mean_shift.hpp.
|
inline |
Set the maximum number of iterations.
Definition at line 98 of file mean_shift.hpp.
|
inline |
Get the maximum number of iterations.
Definition at line 96 of file mean_shift.hpp.
|
inline |
Get the radius.
Definition at line 101 of file mean_shift.hpp.
void Radius | ( | double | radius | ) |
Set the radius.