TTK
Loading...
Searching...
No Matches
ttk::ClusteringMetrics Class Reference

#include <ClusteringMetrics.h>

Inheritance diagram for ttk::ClusteringMetrics:
ttk::Debug ttk::BaseClass ttkClusteringMetrics

Public Member Functions

 ClusteringMetrics ()
int execute (const int *clustering1, const int *clustering2, const size_t n, double &nmiValue, double &ariValue) const
int computeContingencyTables (const int *clust1, const int *clust2, const size_t nPoint, std::vector< std::vector< int > > &contingencyMatrix, std::vector< int > &sumLin, std::vector< int > &sumCol) const
int computeARI (const std::vector< std::vector< int > > &contingencyMatrix, const std::vector< int > &sumLin, const std::vector< int > &sumCol, const size_t nPoint, double &ariValue) const
int computeNMI (const std::vector< std::vector< int > > &contingencyMatrix, const std::vector< int > &sumLin, const std::vector< int > &sumCol, const size_t nPoint, double &nmiValue) const
Public Member Functions inherited from ttk::Debug
 Debug ()
 ~Debug () override
virtual int setDebugLevel (const int &debugLevel)
int setWrapper (const Wrapper *wrapper) override
int printMsg (const std::string &msg, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printMsg (const std::vector< std::string > &msgs, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printErr (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
int printWrn (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
int printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const double &memory, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const
int printMsg (const std::string &msg, const double &progress, const double &time, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const
int printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const
int printMsg (const std::string &msg, const double &progress, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const
int printMsg (const std::string &msg, const double &progress, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printMsg (const std::vector< std::vector< std::string > > &rows, const debug::Priority &priority=debug::Priority::INFO, const bool hasHeader=true, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printMsg (const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const
int printMsg (const debug::Separator &separator, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printMsg (const std::string &msg, const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const
void setDebugMsgPrefix (const std::string &prefix)
Public Member Functions inherited from ttk::BaseClass
 BaseClass ()
virtual ~BaseClass ()=default
int getThreadNumber () const
virtual int setThreadNumber (const int threadNumber)

Additional Inherited Members

Protected Member Functions inherited from ttk::Debug
int printMsgInternal (const std::string &msg, const std::string &right, const std::string &filler, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printMsgInternal (const std::string &msg, const debug::Priority &priority, const debug::LineMode &lineMode, std::ostream &stream=std::cout) const
int welcomeMsg (std::ostream &stream)
Protected Attributes inherited from ttk::Debug
int debugLevel_
std::string debugMsgPrefix_
std::string debugMsgNamePrefix_
Protected Attributes inherited from ttk::BaseClass
bool lastObject_
int threadNumber_
Wrapperwrapper_
Static Protected Attributes inherited from ttk::Debug
static COMMON_EXPORTS debug::LineMode lastLineMode = ttk::debug::LineMode::NEW

Detailed Description

The ClusteringMetrics class provides methods to compute two scores comparing two clustering of the same points. It can compute the NMI score and the ARI score.

Author
Alexandre Talon alexa.nosp@m.ndre.nosp@m..talo.nosp@m.n@li.nosp@m.p6.fr
Date
January 2022

This module defines the ClusteringMetrics class that computes both the NMI (normalized mutual information) and the ARI (adjusted rand index) scores between two clustering of the same points.

Related publication:
'Principal Geodesic Analysis of Merge Trees (and Persistence Diagrams)' Mathieu Pont, Jules Vidal and Julien Tierny. IEEE Transactions on Visualization and Computer Graphics, 2023.

See also
ClusteringMetrics

Definition at line 30 of file ClusteringMetrics.h.

Constructor & Destructor Documentation

◆ ClusteringMetrics()

ttk::ClusteringMetrics::ClusteringMetrics ( )

Definition at line 7 of file ClusteringMetrics.cpp.

Member Function Documentation

◆ computeARI()

int ttk::ClusteringMetrics::computeARI ( const std::vector< std::vector< int > > & contingencyMatrix,
const std::vector< int > & sumLin,
const std::vector< int > & sumCol,
const size_t nPoint,
double & ariValue ) const

Definition at line 103 of file ClusteringMetrics.cpp.

◆ computeContingencyTables()

int ttk::ClusteringMetrics::computeContingencyTables ( const int * clust1,
const int * clust2,
const size_t nPoint,
std::vector< std::vector< int > > & contingencyMatrix,
std::vector< int > & sumLin,
std::vector< int > & sumCol ) const

Definition at line 49 of file ClusteringMetrics.cpp.

◆ computeNMI()

int ttk::ClusteringMetrics::computeNMI ( const std::vector< std::vector< int > > & contingencyMatrix,
const std::vector< int > & sumLin,
const std::vector< int > & sumCol,
const size_t nPoint,
double & nmiValue ) const

Definition at line 154 of file ClusteringMetrics.cpp.

◆ execute()

int ttk::ClusteringMetrics::execute ( const int * clustering1,
const int * clustering2,
const size_t n,
double & nmiValue,
double & ariValue ) const

Definition at line 207 of file ClusteringMetrics.cpp.


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