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 KMeans
Declaration
public KMeansClustering(int maxIterations, int clusterCount, List<VectorNd> data)
Parameters
Type | Name | Description |
---|---|---|
System. |
maxIterations | Maximum iterations allowed. |
System. |
clusterCount | Desired amount of clusters. |
List<Vector |
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<KMeans |
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<Vector |
pool | List of vectors to compare with. |
Vector |
vector | Reference vector. |
Returns
Type | Description |
---|---|
System. |
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 |
---|---|---|
KMeans |
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. |
iterations | Iterations to run. |
System. |
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 |
---|---|
Event |