Class KMeansClustering
Generic K-Means Clustering Algorithm for N dimensional vectors.
Inheritance
System.Object
KMeansClustering
Namespace: Paramdigma.Core.Optimization
Assembly: Paramdigma.Core.dll
Syntax
public class KMeansClustering : object
Constructors
| Improve this Doc View SourceKMeansClustering(Int32, Int32, List<VectorNd>)
Initializes a new instance of the KMeansClustering class.
Declaration
public KMeansClustering(int maxIterations, int clusterCount, List<VectorNd> data)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maxIterations | Maximum iterations allowed. |
System.Int32 | clusterCount | Desired amount of clusters. |
List<VectorNd> | data | List of N dimensional vectors to cluster. |
Properties
| Improve this Doc View SourceClusters
Gets or sets the list of clusters.
Declaration
public List<KMeansCluster> Clusters { get; set; }
Property Value
Type | Description |
---|---|
List<KMeansCluster> |
Methods
| Improve this Doc View SourceFindIndexOfSimilar(List<VectorNd>, VectorNd)
Find the index of the most similar vector to a given one.
Declaration
public int FindIndexOfSimilar(List<VectorNd> pool, VectorNd vector)
Parameters
Type | Name | Description |
---|---|---|
List<VectorNd> | pool | List of vectors to compare with. |
VectorNd | vector | Reference vector. |
Returns
Type | Description |
---|---|
System.Int32 | Index of the most similar vector in the pool. |
OnIterationCompleted(KMeansClustering.IterationCompletedEventArgs)
Method to call when an iteration is completed.
Declaration
protected virtual void OnIterationCompleted(KMeansClustering.IterationCompletedEventArgs iterArgs)
Parameters
Type | Name | Description |
---|---|---|
KMeansClustering.IterationCompletedEventArgs | iterArgs | Data for the current iteration. |
Run()
Run the algorithm until it reaches the maximum amount of iterations.
Declaration
public void Run()
Run(Int32, Boolean)
Run the k-means clustering algorithm for a specified amount of iterations.
Declaration
public void Run(int iterations, bool allowEmptyClusters)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iterations | Iterations to run. |
System.Boolean | allowEmptyClusters | True to allow the optimization to leave clusters empty. |
Events
| Improve this Doc View SourceIterationCompleted
Raised when an iteration is completed.
Declaration
public event EventHandler<KMeansClustering.IterationCompletedEventArgs> IterationCompleted
Event Type
Type | Description |
---|---|
EventHandler<KMeansClustering.IterationCompletedEventArgs> |