![]() |
Vulpes
0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
|
Implementation of the Lloyd algorithm (also known as the naive KMeans) for clustering. More...
#include <kmeans.hpp>
Public Types | |
| using | LabelType = KMeansBase<T, Dim>::LabelType |
| using | DataType = KMeansBase<T, Dim>::DataType |
| using | CentersType = KMeansBase<T, Dim>::CentersType |
Public Member Functions | |
| KMeansNaive (DataType x, size_t k, size_t max_iter=1e6, T tol=1e-6, std::size_t seed=0) | |
| void | fit () override |
| Runs the KMeans clustering algorithm on the input data. | |
| auto | getIterNum () const |
| const LabelType & | getLabels () const |
| const CentersType & | getCentroids () const |
Protected Attributes | |
| bool | m_fitted |
| size_t | m_n_clusters |
| size_t | m_max_iter |
| T | m_tol |
| size_t | m_seed |
| size_t | m_n_samples |
| size_t | m_n_iter |
| CentersType | m_centroids |
| LabelType | m_labels |
Private Attributes | |
| DataType | m_data_points |
Implementation of the Lloyd algorithm (also known as the naive KMeans) for clustering.
This class provides a straightforward implementation of the classic Lloyd's algorithm to solve the KMeans clustering problem. It iteratively assigns each data point to the nearest centroid and updates centroids as the mean of their assigned points, converging to a local minimum of the KMeans objective. The class inherits from KMeansBase and uses its interface and types.
| T | Floating point type for the input data (e.g., float, double). |
| Dim | Dimensionality of the input data |
| using vulpes::geometry::KMeansNaive< T, Dim >::CentersType = KMeansBase<T, Dim>::CentersType |
| using vulpes::geometry::KMeansNaive< T, Dim >::DataType = KMeansBase<T, Dim>::DataType |
| using vulpes::geometry::KMeansNaive< T, Dim >::LabelType = KMeansBase<T, Dim>::LabelType |
|
inline |
|
overridevirtual |
Runs the KMeans clustering algorithm on the input data.
This method must be implemented by derived classes. It performs clustering and updates the centroids and labels accordingly.
Implements vulpes::geometry::KMeansBase< T, Dim >.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
protectedinherited |
|
private |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |