Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Private Member Functions

ClusterAnalyzer Class Reference
[Clustering]

Bundles analyzing tools for a clustering (given as sequence of BinaryTreeNode's). More...

#include <OpenMS/COMPARISON/CLUSTERING/ClusterAnalyzer.h>

List of all members.

Public Member Functions

 ClusterAnalyzer ()
 default constructor
 ClusterAnalyzer (const ClusterAnalyzer &source)
 copy constructor
virtual ~ClusterAnalyzer ()
 destructor
std::vector< RealaverageSilhouetteWidth (const std::vector< BinaryTreeNode > &tree, const DistanceMatrix< Real > &original)
 Method to calculate the average silhouette widths for a clustering.
std::vector< RealdunnIndices (const std::vector< BinaryTreeNode > &tree, const DistanceMatrix< Real > &original, const bool tree_from_singlelinkage=false)
 Method to calculate Dunns indices for a clustering.
std::vector< Realcohesion (const std::vector< std::vector< Size > > &clusters, const DistanceMatrix< Real > &original)
 Method to calculate the cohesions of a certain partition.
Real averagePopulationAberration (Size cluster_quantity, std::vector< BinaryTreeNode > &tree)
 Method to calculate the average aberration from average population in partition resulting from a certain step in clustering.
void cut (const Size cluster_quantity, const std::vector< BinaryTreeNode > &tree, std::vector< std::vector< Size > > &clusters)
 Method to calculate a partition resulting from a certain step in clustering given by the number of clusters.
void cut (const Size cluster_quantity, const std::vector< BinaryTreeNode > &tree, std::vector< std::vector< BinaryTreeNode > > &subtrees)
 Method to calculate subtrees from a given tree resulting from a certain step in clustering given by the number of clusters.
String newickTree (const std::vector< BinaryTreeNode > &tree, const bool include_distance=false)
 Returns the hierarchy described by a clustering tree as Newick-String.

Private Member Functions

ClusterAnalyzeroperator= (const ClusterAnalyzer &source)
 assignment operator

Detailed Description

Bundles analyzing tools for a clustering (given as sequence of BinaryTreeNode's).


Constructor & Destructor Documentation

ClusterAnalyzer (  ) 

default constructor

ClusterAnalyzer ( const ClusterAnalyzer source  ) 

copy constructor

virtual ~ClusterAnalyzer (  )  [virtual]

destructor


Member Function Documentation

Real averagePopulationAberration ( Size  cluster_quantity,
std::vector< BinaryTreeNode > &  tree 
)

Method to calculate the average aberration from average population in partition resulting from a certain step in clustering.

Parameters:
cluster_quantity desired partition Size analogue to ClusterAnalyzer::cut
tree vector of BinaryTreeNode's representing the clustering
Exceptions:
invalid_parameter if desired clustering is invalid
Returns:
the average aberration from the average cluster population (number of elements/cluster_quantity) at cluster_quantity
See also:
BinaryTreeNode
std::vector<Real> averageSilhouetteWidth ( const std::vector< BinaryTreeNode > &  tree,
const DistanceMatrix< Real > &  original 
)

Method to calculate the average silhouette widths for a clustering.

Parameters:
tree vector of BinaryTreeNode's representing the clustering
original DistanceMatrix for all clustered elements started from
Returns:
a vector filled with the average silhouette widths for each clusterstep

The average silhouette width will becalculated for each clustering step beginning with the first step(n-1 cluster) ending with the last (1 cluster, average silhouette width is 0 by definition).

See also:
BinaryTreeNode
std::vector<Real> cohesion ( const std::vector< std::vector< Size > > &  clusters,
const DistanceMatrix< Real > &  original 
)

Method to calculate the cohesions of a certain partition.

Parameters:
clusters vector of vectors holding the clusters (with indices to the actual elements)
original DistanceMatrix for all clustered elements started from
Returns:
a vector that holds the cohesions of each cluster given with clusters (order corresponds to clusters)
void cut ( const Size  cluster_quantity,
const std::vector< BinaryTreeNode > &  tree,
std::vector< std::vector< Size > > &  clusters 
)

Method to calculate a partition resulting from a certain step in clustering given by the number of clusters.

If you want to fetch all clusters which were created with a threshold, you simply count the number of tree-nodes which are not -1, and substract that from the number of leafes, to get the number of clusters formed , i.e. cluster_quantity = data.size() - real_leaf_count;

Parameters:
cluster_quantity Size giving the number of clusters (i.e. starting elements - cluster_quantity = cluster step)
tree vector of BinaryTreeNode's representing the clustering
clusters vector of vectors holding the clusters (with indices to the actual elements)
Exceptions:
invalid_parameter if desired clusterstep is invalid
See also:
BinaryTreeNode

after call of this method the argument clusters is filled corresponding to the given cluster_quantity with the indices of the elements clustered

Referenced by SpectraMerger::mergeSpectraPrecursors().

void cut ( const Size  cluster_quantity,
const std::vector< BinaryTreeNode > &  tree,
std::vector< std::vector< BinaryTreeNode > > &  subtrees 
)

Method to calculate subtrees from a given tree resulting from a certain step in clustering given by the number of clusters.

Parameters:
cluster_quantity Size giving the number of clusters (i.e. starting elements - cluster_quantity = cluster step)
tree vector of BinaryTreeNode's representing the clustering
subtrees vector of trees holding the trees, tree is composed of cut at given size
Exceptions:
invalid_parameter if desired clusterstep is invalid
See also:
BinaryTreeNode

after call of this method the argument clusters is filled corresponding to the given cluster_quantity with the indices of the elements clustered

std::vector<Real> dunnIndices ( const std::vector< BinaryTreeNode > &  tree,
const DistanceMatrix< Real > &  original,
const bool  tree_from_singlelinkage = false 
)

Method to calculate Dunns indices for a clustering.

Parameters:
tree vector of BinaryTreeNode's representing the clustering
original DistanceMatrix for all clustered elements started from
tree_from_singlelinkage true if tree was created by SingleLinkage, i.e. the distances are the minimal distances in increasing order and can be used to speed up the calculation
See also:
BinaryTreeNode
String newickTree ( const std::vector< BinaryTreeNode > &  tree,
const bool  include_distance = false 
)

Returns the hierarchy described by a clustering tree as Newick-String.

Parameters:
tree vector of BinaryTreeNode's representing the clustering
include_distance bool value indicating whether the distance shall be included to the string
See also:
BinaryTreeNode
ClusterAnalyzer& operator= ( const ClusterAnalyzer source  )  [private]

assignment operator


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:50 using doxygen 1.7.1