OpenMS
ClusterFunctor Class Referenceabstract

Base class for cluster functors. More...

#include <OpenMS/ML/CLUSTERING/ClusterFunctor.h>

Inheritance diagram for ClusterFunctor:
[legend]

Classes

class  InsufficientInput
 Exception thrown if not enough data (<2) is used. More...
 

Public Member Functions

 ClusterFunctor ()
 default constructor More...
 
 ClusterFunctor (const ClusterFunctor &source)
 copy constructor More...
 
virtual ~ClusterFunctor ()
 destructor More...
 
ClusterFunctoroperator= (const ClusterFunctor &source)
 assignment operator More...
 
virtual void operator() (DistanceMatrix< float > &original_distance, std::vector< BinaryTreeNode > &cluster_tree, const float threshold=1) const =0
 abstract for clustering the indices according to their respective element distances More...
 

Detailed Description

Base class for cluster functors.

Each cluster functor employs a different method for stepwise merging clusters up to a given threshold, starting from the most elementary partition of data. Elements are represented by indices of a given distance matrix, which also should represent the order of input.

Constructor & Destructor Documentation

◆ ClusterFunctor() [1/2]

default constructor

◆ ClusterFunctor() [2/2]

ClusterFunctor ( const ClusterFunctor source)

copy constructor

◆ ~ClusterFunctor()

virtual ~ClusterFunctor ( )
virtual

destructor

Member Function Documentation

◆ operator()()

virtual void operator() ( DistanceMatrix< float > &  original_distance,
std::vector< BinaryTreeNode > &  cluster_tree,
const float  threshold = 1 
) const
pure virtual

abstract for clustering the indices according to their respective element distances

Parameters
original_distanceDistanceMatrix<float> containing the distances of the elements to be clustered, will be changed during clustering process, make sure to have a copy or be able to redo
cluster_treevector< BinaryTreeNode >, represents the clustering, each node contains the next merged clusters (not element indices) and their distance, strict order is kept: left_child < right_child,
thresholdfloat value, the minimal distance from which on cluster merging is considered unrealistic. By default set to 1, i.e. complete clustering until only one cluster remains

original_distance is considered mirrored at the main diagonal, so only entries up the main diagonal are used. The threshold can be taken from the maximal distance of two elements considered related and adapted in a way corresponding to the employed clustering method. The results are represented by cluster_tree, to get the actual clustering (with element indices) from a certain step of the clustering

See also
BinaryTreeNode , ClusterAnalyzer::cut

Implemented in SingleLinkage, CompleteLinkage, and AverageLinkage.

◆ operator=()

ClusterFunctor& operator= ( const ClusterFunctor source)

assignment operator