MLpp
ml::Clustering::Model Class Referenceabstract

Abstract clustering model. More...

#include <Clustering.hpp>

Inheritance diagram for ml::Clustering::Model:

Public Member Functions

virtual ~Model ()
 Virtual destructor.
 
virtual bool fit (Eigen::Ref< const Eigen::MatrixXd > data)=0
 Fits the model. More...
 
virtual unsigned int number_clusters () const =0
 Returns the number of clusters. More...
 
virtual const std::vector< unsigned int > & labels () const =0
 Returns a const reference to resulting cluster labels for each datapoint. Value make sense only if fitting converged successfully.
 
virtual const Eigen::MatrixXd & centroids () const =0
 Returns a const reference to the matrix of cluster centroids (in columns). More...
 
virtual bool converged () const =0
 Reports if the model converged.
 

Detailed Description

Abstract clustering model.

Member Function Documentation

◆ fit()

virtual bool ml::Clustering::Model::fit ( Eigen::Ref< const Eigen::MatrixXd >  data)
pure virtual

Fits the model.

Parameters
[in]dataMatrix (column-major order) with a data point in every column.
Returns
true if fitting converged successfully.
Exceptions
std::invalid_argumentIf data has no rows, or if the sample size (number of columns in data) is too low.

Implemented in ml::EM, and ml::Clustering::KMeans.

◆ number_clusters()

virtual unsigned int ml::Clustering::Model::number_clusters ( ) const
pure virtual

Returns the number of clusters.

Value make sense only if fitting converged successfully.

Implemented in ml::EM, and ml::Clustering::KMeans.

◆ centroids()

virtual const Eigen::MatrixXd& ml::Clustering::Model::centroids ( ) const
pure virtual

Returns a const reference to the matrix of cluster centroids (in columns).

A centroid represent the central location of the cluster. It is e.g. a mean of all points in the cluster. Value make sense only if fitting converged successfully.

Implemented in ml::EM, and ml::Clustering::KMeans.


The documentation for this class was generated from the following file: