Click or drag to resize
Accord.NET (logo)

ICentroidClusterCollectionTData, TCentroids, TClusterDistortion 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
double Distortion(
	TData[] data,
	int[] labels = null,
	double[] weights = null
)

Parameters

data
Type: TData
labels (Optional)
Type: SystemInt32
weights (Optional)
Type: SystemDouble

Return Value

Type: Double
The average square distance from the data points to the nearest clusters' centroids.
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