Accord.NET Framework

## KMedoids Class |

k-Medoids clustering using PAM (Partition Around Medoids) algorithm.

Inheritance Hierarchy

SystemObject

Accord.MachineLearningParallelLearningBase

Accord.MachineLearningKMedoidsDouble

Accord.MachineLearningKMedoids

Accord.MachineLearningParallelLearningBase

Accord.MachineLearningKMedoidsDouble

Accord.MachineLearningKMedoids

Syntax

The KMedoids type exposes the following members.

Constructors

Properties

Name | Description | |
---|---|---|

Clusters |
Gets the clusters found by k-Medoids.
(Inherited from KMedoidsT.) | |

ComputeError |
Gets or sets whether the clustering distortion error (the
average distance between all data points and the cluster
centroids) should be computed at the end of the algorithm.
The result will be stored in Error. Default is true.
(Inherited from KMedoidsT.) | |

Dimension |
Gets the dimensionality of the data space.
(Inherited from KMedoidsT.) | |

Distance |
Gets or sets the distance function used
as a distance metric between data points.
(Inherited from KMedoidsT.) | |

Error |
Gets the cluster distortion error (the average distance
between data points and the cluster centroids) after the
last call to this class' Compute methods.
(Inherited from KMedoidsT.) | |

Initialization |
Gets or sets the strategy used to initialize the
centroids of the clustering algorithm. Default is
PamBuild.
(Inherited from KMedoidsT.) | |

Iterations |
Gets the number of iterations performed in the
last call to this class' Compute methods.
(Inherited from KMedoidsT.) | |

K |
Gets the number of clusters.
(Inherited from KMedoidsT.) | |

MaxIterations |
Gets or sets the maximum number of iterations to
be performed by the method. If set to zero, no
iteration limit will be imposed. Default is 0.
(Inherited from KMedoidsT.) | |

ParallelOptions |
Gets or sets the parallelization options for this algorithm.
(Inherited from ParallelLearningBase.) | |

Token |
Gets or sets a cancellation token that can be used
to cancel the algorithm while it is running.
(Inherited from ParallelLearningBase.) | |

Tolerance |
Gets or sets the relative convergence threshold
for stopping the algorithm. Default is 1e-5.
(Inherited from KMedoidsT.) |

Methods

Name | Description | |
---|---|---|

Compute |
Implementation of the PAM algorithm.
(Inherited from KMedoidsT.) | |

Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |

Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |

GetHashCode | Serves as the default hash function. (Inherited from Object.) | |

GetType | Gets the Type of the current instance. (Inherited from Object.) | |

Learn |
Learns a model that can map the given inputs to the desired outputs.
(Inherited from KMedoidsT.) | |

MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |

ToString | Returns a string that represents the current object. (Inherited from Object.) |

Extension Methods

Name | Description | |
---|---|---|

HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |

IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |

To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |

ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |

Remarks

From Wikipedia:

The k-medoids algorithm is a clustering algorithm related to the k-means algorithm and the medoidshift algorithm. Both the k-means and k-medoids algorithms are partitional (breaking the dataset up into groups) and both attempt to minimize the distance between points labeled to be in a cluster and a point designated as the center of that cluster. In contrast to the k-means algorithm, k-medoids chooses datapoints as centers (medoids or exemplars) and works with a generalization of the Manhattan Norm to define distance between datapoints instead of L2. This method was proposed in 1987[1] for the work with L1 norm and other distances.

The most common realisation of k-medoid clustering is the Partitioning Around Medoids (PAM) algorithm. PAM uses a greedy search which may not find the optimum solution, but it is faster than exhaustive search.

[1] Kaufman, L. and Rousseeuw, P.J. (1987), Clustering by means of Medoids, in Statistical Data Analysis Based on the L1–Norm and Related Methods, edited by Y. Dodge, North-Holland, 405–416.

This is the specialized, non-generic version of the k-Medoids algorithm that is set to work on Double32 arrays.

See Also