KMeansOptions<T>
Options & Configuration · AiDotNet.Clustering.Options
Configuration options specific to KMeans clustering.
Inheritance: ModelOptions → ClusteringOptions<T> → KMeansOptions<T>
For Beginners
KMeans works by:
- Choosing k initial center points
- Assigning each data point to its nearest center
- Recalculating centers as the mean of assigned points
- Repeating steps 2-3 until centers stabilize
The key settings are:
- Number of clusters (k): How many groups to find
- Initialization method: How to choose starting centers
- Number of runs: How many times to try different starting points
How It Works
KMeans is a centroid-based clustering algorithm that partitions n observations into k clusters where each observation belongs to the cluster with the nearest centroid.
Constructors
| Constructor | Summary |
|---|---|
KMeansOptions() |
Properties
| Property | Summary |
|---|---|
KMeansAlgorithm Algorithm { get; set; } |
Gets or sets the algorithm variant to use. |
KMeansInitMethod InitMethod { get; set; } |
Gets or sets the initialization method for cluster centers. |
Matrix<T> InitialCenters { get; set; } |
Gets or sets custom initial cluster centers. |
PrecomputeOption PrecomputeDistances { get; set; } |
Gets or sets whether to precompute distances. |
bool CopyX { get; set; } |
Gets or sets whether to copy input data for safety. |
int NumClusters { get; set; } |
Gets or sets the number of clusters to find. |
int? KMeansPlusPlusLocalTrials { get; set; } |
Gets or sets how many candidates k-means++ draws for each new center, keeping the one that lowers the total squared distance most. |