Click or drag to resize

KMeansTData, TDataSum Class

Clusters data using the KMeans algorithm.
Inheritance Hierarchy
SystemObject
  Altaxo.Calc.ClusteringKMeansTData, TDataSum
    Altaxo.Calc.ClusteringKMeans_Double1D

Namespace: Altaxo.Calc.Clustering
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public class KMeans<TData, TDataSum>

Type Parameters

TData
Type of the data.
TDataSum
Type of data that is used to calculate the mean by summing up and dividing by the cluster count.

The KMeansTData, TDataSum type exposes the following members.

Constructors
 NameDescription
Public methodCode exampleKMeansTData, TDataSum Initalize a new instance of KMeansTData, TDataSum.
Top
Properties
 NameDescription
Public propertyClusterCounts Gets a list which contains the number of values in each of the clusters (length is numberOfClusters).
Public propertyClusterIndices Gets a list with the same length as the number of data points, in which each element is the index of the cluster this data point is assigned to.
Public propertyClusterMeans Gets a list which contains the mean values of the clusters (length is numberOfClusters).
Public propertyData Gets a list which contains the data points provided.
Public propertyHasPatchingEmptyClustersFailed If true, during evaluation, empty clusters have appeared, which could not be patched with other data.
Public propertyHasReachedMaximumNumberOfIterations If true, the evaluation has reached the maximum number of iterations, without converging.
Public propertySortingOfClusterValues Get/sets the sorting of cluster values after evaluation. It presumes that the generic type TDataSum implements the IComparable interface.
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodEvaluate Clusters the provided data. Please note that the data are not normalized. Thus, for multidimensional data, please normalize the data before!
Public methodEvaluateClustersStandardDeviation Evaluates for each cluster the standard deviation, i.e. the square root ( of the sum of squared distances divided by N-1)
Public methodEvaluateDaviesBouldinIndex(FuncTDataSum, TDataSum, Double) Evaluates the Davies-Bouldin-Index. The exponent q (see EvaluateDaviesBouldinIndex(FuncTDataSum, TDataSum, Double, Int32)) is set to 1, meaning that the mean Euclidean distance of the points to their respective centroid is used in the nominator.
Public methodEvaluateDaviesBouldinIndex(FuncTDataSum, TDataSum, Double, Int32) Evaluates the Davies-Bouldin-Index. The exponent q (used to calculate the average distance of the cluster points to their centroid) can be set as parameter.
Public methodEvaluateMean2ndMomentOfDistances Evaluates for each cluster the 2nd moment of the distances, i.e. the square root of the average of the squared Euclidean distances (or whatever the distance function is) of the points to their respective centroid.
Public methodEvaluateMeanDistances Evaluates for each cluster the mean distance, i.e. the average of the Euclidean distances (or whatever the distance function is) of the points to their respective centroid.
Public methodEvaluateMeanNthMomentOfDistances Evaluates for each cluster the mean distance, i.e. the square root ( of the sum of squared distances divided by N)
Public methodEvaluateSumOfSquaredDistancesToClusterMean Evaluates the sum of (squared distance of each point to its cluster center).
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Protected methodGetFarthestPoint Returns the index of the point that is farthest outside the mean of its cluster.
Protected methodGetFarthestPointOfBiggestCluster Returns the index of the point that is farthest outside the mean of its cluster.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodInitializeCentroidsAtRandom Initialize the centroids with a randomly choosen value from the data set. Initializing in this way gives poor clustering results, thus we don't use it currently. Advantage: much faster than InitializeCentroidsUsingKMeansPlusPlus.
Protected methodInitializeCentroidsUsingKMeansPlusPlus Initializes the cluster mean values using the KMeans++ procedure (http://en.wikipedia.org/wiki/K-means%2B%2B). This is slower than InitializeCentroidsAtRandom, but after initializing in this way, significant lesser iterations are neccessary.
Protected methodInternalEvaluateMeanNthMomentOfDistances Evaluates for each cluster the 2nd moment of the distances, i.e. the square root of the average of the squared Euclidean distances (or whatever the distance function is) of the points to their respective centroid.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Protected methodPatchEmptyClusters Tries to fill up empty clusters, by searching the biggest cluster, and then use the farthest point from that biggest cluster to move to the empty cluster.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodTryEvaluate Clusters the provided data. Please note that the data are not normalized. Thus, for multidimensional data, please normalize the data before!
Protected methodUpdateClusterMeanValues Calculates the mean values of the clusters from the data points.
Protected methodUpdateEachPointsMembership Iterates over each data point, and determines to which cluster it belongs.
Top
Remarks
See Also