Cpp ML Library
1.0.0
A library of Machine Learning Algorithmns seen from the Udemy course Machine Learning A to Z.
|
Agglomerative Hierarchical Clustering for clustering tasks. More...
#include <HierarchicalClustering.hpp>
Public Types | |
enum class | Linkage { SINGLE , COMPLETE , AVERAGE } |
Linkage criteria for clustering. | |
Public Member Functions | |
HierarchicalClustering (int n_clusters=2, Linkage linkage=Linkage::AVERAGE) | |
Constructs a HierarchicalClustering instance. More... | |
~HierarchicalClustering () | |
Destructor for HierarchicalClustering. | |
void | fit (const std::vector< std::vector< double >> &X) |
Fits the clustering algorithm to the data. More... | |
std::vector< int > | predict () const |
Predicts the cluster labels for the data. More... | |
std::vector< std::vector< double > > | get_cluster_centers () const |
Retrieves the cluster centers (centroids) after fitting. More... | |
Agglomerative Hierarchical Clustering for clustering tasks.
HierarchicalClustering::HierarchicalClustering | ( | int | n_clusters = 2 , |
Linkage | linkage = Linkage::AVERAGE |
||
) |
Constructs a HierarchicalClustering instance.
n_clusters | The number of clusters to form. |
linkage | The linkage criterion to use. |
void HierarchicalClustering::fit | ( | const std::vector< std::vector< double >> & | X | ) |
Fits the clustering algorithm to the data.
X | A vector of feature vectors (data points). |
std::vector< std::vector< double > > HierarchicalClustering::get_cluster_centers | ( | ) | const |
Retrieves the cluster centers (centroids) after fitting.
std::vector< int > HierarchicalClustering::predict | ( | ) | const |
Predicts the cluster labels for the data.