Click or drag to resize

NMathFunctionsInitialCenters Method

Chooses the specified number of initial centers from the given data matrix, for clustering algorithms such as k-means.

Namespace: CenterSpace.NMath.Core
Assembly: NMath (in NMath.dll) Version: 7.4
Syntax
public static int[] InitialCenters(
	DoubleMatrix data,
	int k
)

Parameters

data  DoubleMatrix
A matrix of data. Each row in the matrix represents an object to be clustered.
k  Int32
The number of initial cluster centers.

Return Value

Int32
An array of row indices.
Exceptions
ExceptionCondition
InvalidArgumentException Thrown if the number of cluster centers is less than one or greater than the number of data points (data.Rows).
Remarks
Uses the following algorithm: If the distance between row r and its closest center is greater than the distance between the two closest centers (m, n), then r replaces m or n, whichever is closest to r. Otherwise, if the distance between row r and its closest center (q) is greater than the distance between q and its closest center, then row r replaces q. (Similar to SPSS QuickCluster function.)
See Also