Skip to content
KMeans clustering in Eigen.
C++ CMake
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
CMakeHelpers @ 85cf150
Helpers @ e53bc2f
.gitignore Find Eigen correctly. May 9, 2015
CMakeLists.txt Use CMakeHelpers to register this as a submodule. May 11, 2015
KMeansClusteringExample.cpp Update Apr 15, 2016

This is a c++ implementation of the K-Means clustering algorithm. It also includes the KMeans++ initialization algorithm.

Obtaining the code: Please be sure to: git clone --recursive

so that the submodules will also be checked out.

Example usage:

KMeansClustering::VectorOfPoints points = ... load data ... KMeansClustering kmeans; kmeans.SetK(2); // specify the number of clusters kmeans.SetPoints(points); kmeans.Cluster(); // Perform the clustering

// Get the membership of every point std::vector labels = GetLabels();

// Get all points ids with a particular membership (in this case, cluster 0) std::vector pointIdsInCluster0 = kmeans.GetIndicesWithLabel(0);

/** Get the points with a specified cluster membership. */ VectorOfPoints pointsInCluster0 = kmeans.GetPointsWithLabel(0);

Something went wrong with that request. Please try again.