23 KMeans(Index clusters = 3, Index = 100);
56 Index clusters_number;
57 Index maximum_iterations;
Index find_optimal_clusters(const VectorR &) const
Returns the cluster count located at the elbow of the supplied distortion curve.
VectorR elbow_method(const MatrixR &, Index=10)
Runs the elbow method on the supplied data over a range of cluster counts.
void set_centers_random(const MatrixR &)
Initializes cluster centres by sampling at random from the supplied data.
void fit(const MatrixR &)
Fits the K-means model on the supplied data matrix.
KMeans(Index clusters=3, Index=100)
Builds a K-means instance with the given cluster count and maximum number of iterations.
MatrixR get_cluster_centers() const
Returns the centroid of each cluster as rows of the returned matrix.
VectorI get_cluster_labels() const
Returns the cluster label assigned to each fitted sample.
Index get_clusters_number() const
Returns the number of clusters configured for the algorithm.
void set_cluster_number(const Index)
Sets the desired number of clusters.
VectorI calculate_outputs(const MatrixR &)
Assigns each row of the input matrix to its nearest cluster.
Definition adaptive_moment_estimation.h:14
Matrix< float, Dynamic, 1 > VectorR
Definition pch.h:181
Matrix< float, Dynamic, Dynamic, Layout > MatrixR
Definition pch.h:177
Matrix< Index, Dynamic, 1 > VectorI
Definition pch.h:182