This repository was archived by the owner on Nov 19, 2020. It is now read-only.
  
  
  - 
                Notifications
    You must be signed in to change notification settings 
- Fork 2k
Clustering
        Leon Pierre edited this page Apr 13, 2018 
        ·
        4 revisions
      
    using Accord.MachineLearning;
Accord.Math.Random.Generator.Seed = 0;
// Declare some observations
double[][] observations =
{
    new double[] { -5, -2, -1 },
    new double[] { -5, -5, -6 },
    new double[] {  2,  1,  1 },
    new double[] {  1,  1,  2 },
    new double[] {  1,  2,  2 },
    new double[] {  3,  1,  2 },
    new double[] { 11,  5,  4 },
    new double[] { 15,  5,  6 },
    new double[] { 10,  5,  6 },
};
// Create a new K-Means algorithm with 3 clusters 
KMeans kmeans = new KMeans(3);
// Compute the algorithm, retrieving an integer array
//  containing the labels for each of the observations
KMeansClusterCollection clusters = kmeans.Learn(observations);
// As a result, the first two observations should belong to the
//  same cluster (thus having the same label). The same should
//  happen to the next four observations and to the last three.
int[] labels = clusters.Decide(observations);Help improve this wiki! Those pages can be edited by anyone that would like to contribute examples and documentation to the framework.
Have you found this software useful? Consider donating only U$10 so it can get even better! This software is completely free and will always stay free. Enjoy!