|
OpenNN
Open-source neural networks library
|
K-means clustering utility that partitions samples into the requested number of clusters. More...
#include <kmeans.h>
Public Member Functions | |
| KMeans (Index clusters=3, Index=100) | |
| Builds a K-means instance with the given cluster count and maximum number of iterations. | |
| VectorI | calculate_outputs (const MatrixR &) |
| Assigns each row of the input matrix to its nearest cluster. | |
| VectorR | elbow_method (const MatrixR &, Index=10) |
| Runs the elbow method on the supplied data over a range of cluster counts. | |
| Index | find_optimal_clusters (const VectorR &) const |
| Returns the cluster count located at the elbow of the supplied distortion curve. | |
| VectorI | get_cluster_labels () const |
| Returns the cluster label assigned to each fitted sample. | |
| MatrixR | get_cluster_centers () const |
| Returns the centroid of each cluster as rows of the returned matrix. | |
| Index | get_clusters_number () const |
| Returns the number of clusters configured for the algorithm. | |
| void | fit (const MatrixR &) |
| Fits the K-means model on the supplied data matrix. | |
| void | set_cluster_number (const Index) |
| Sets the desired number of clusters. | |
| void | set_centers_random (const MatrixR &) |
| Initializes cluster centres by sampling at random from the supplied data. | |
K-means clustering utility that partitions samples into the requested number of clusters.
| opennn::KMeans::KMeans | ( | Index | clusters = 3, |
| Index | = 100 ) |
Builds a K-means instance with the given cluster count and maximum number of iterations.
Assigns each row of the input matrix to its nearest cluster.
Runs the elbow method on the supplied data over a range of cluster counts.
| Index opennn::KMeans::find_optimal_clusters | ( | const VectorR & | ) | const |
Returns the cluster count located at the elbow of the supplied distortion curve.
| void opennn::KMeans::fit | ( | const MatrixR & | ) |
Fits the K-means model on the supplied data matrix.
| MatrixR opennn::KMeans::get_cluster_centers | ( | ) | const |
Returns the centroid of each cluster as rows of the returned matrix.
| VectorI opennn::KMeans::get_cluster_labels | ( | ) | const |
Returns the cluster label assigned to each fitted sample.
| Index opennn::KMeans::get_clusters_number | ( | ) | const |
Returns the number of clusters configured for the algorithm.
| void opennn::KMeans::set_centers_random | ( | const MatrixR & | ) |
Initializes cluster centres by sampling at random from the supplied data.
| void opennn::KMeans::set_cluster_number | ( | const Index | ) |
Sets the desired number of clusters.