| NMathFunctionsInitialCenters Method |
Chooses the specified number of initial centers from the given data matrix, for clustering algorithms
such as k-means.
Namespace: CenterSpace.NMath.CoreAssembly: NMath (in NMath.dll) Version: 7.4
Syntax public static int[] InitialCenters(
DoubleMatrix data,
int k
)
Public Shared Function InitialCenters (
data As DoubleMatrix,
k As Integer
) As Integer()
public:
static array<int>^ InitialCenters(
DoubleMatrix^ data,
int k
)
static member InitialCenters :
data : DoubleMatrix *
k : int -> int[]
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 Exception | Condition |
---|
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