Click or drag to resize
Accord.NET (logo)

KMeansClusterCollectionDistortion Method

Calculates the average square distance from the data points to the nearest clusters' centroids.

Namespace:  Accord.MachineLearning
Assembly:  Accord.MachineLearning (in Accord.MachineLearning.dll) Version: 3.8.0
Syntax
public double Distortion(
	double[][] data,
	int[] labels = null,
	double[] weights = null
)
Request Example View Source

Parameters

data
Type: SystemDouble
The data.
labels (Optional)
Type: SystemInt32
The labels.
weights (Optional)
Type: SystemDouble
The weights.

Return Value

Type: Double
The average square distance from the data points to the nearest clusters' centroids.

Implements

ICentroidClusterCollectionTData, TCentroids, TClusterDistortion(TData, Int32, Double)
Remarks
The average distance from centroids can be used as a measure of the "goodness" of the clustering. The more the data are aggregated around the centroids, the less the average distance.
See Also