6#include "../utils/matrix.hpp"
16 using namespace utils;
112 void init_centroids(
const Matrix<T> &data);
120 std::vector<int> assign_clusters(
const Matrix<T> &data)
const;
128 void update_centroids(
const Matrix<T> &data,
const std::vector<int> &
labels);
137 T squared_distance(
const std::vector<T> &
point1,
const std::vector<T> &
point2)
const;
T inertia() const
Get the within-cluster sum of squares (inertia)
std::vector< int > fit_predict(const Matrix< T > &data)
Fit the model and predict cluster labels.
std::vector< int > predict(const Matrix< T > &data) const
Predict cluster labels for the given data.
Matrix< T > cluster_centers() const
Get the cluster centroids.
size_t n_iter() const
Get the number of iterations performed.
void fit(const Matrix< T > &data)
Fit the K-Means model to the data.
Namespace containing traditional machine learning algorithms.