Xmipp
v3.23.11-Nereus
|
#include <ahc_classifier.h>
Public Member Functions | |
void | clusterData (const Matrix2D< double > &X, int numberOfClusters=2, int distance=2, int linkageType=1) |
void | clusterWithDistance (const Matrix2D< double > &D, int numberOfClusters=2, int linkageType=1) |
Public Attributes | |
Matrix1D< int > | clusterAssigned |
std::vector< std::vector< int > > | cluster |
AHC classifier class.
Definition at line 38 of file ahc_classifier.h.
void AHCClassifier::clusterData | ( | const Matrix2D< double > & | X, |
int | numberOfClusters = 2 , |
||
int | distance = 2 , |
||
int | linkageType = 1 |
||
) |
Cluster data. X is the data to classify, each row is an observation. Columns are features of that observation.
For the distances see http://www.alglib.net/translator/man/manual.cpp.html#sub_clusterizersetpoints 0 Chebyshev distance (L-inf norm) 1 city block distance (L1 norm) 2 Euclidean distance (L2 norm) 10 Pearson correlation: dist(a,b) = 1-corr(a,b) 11 Absolute Pearson correlation: dist(a,b) = 1-|corr(a,b)| 12 Uncentered Pearson correlation (cosine of the angle): dist(a,b) = a'b/(|a||b|) 13 Absolute uncentered Pearson correlation dist(a,b) = |a'b|/(|a||b|) 20 Spearman rank correlation: dist(a,b) = 1-rankcorr(a,b) 21 Absolute Spearman rank correlation dist(a,b) = 1-|rankcorr(a,b)|
For linkage: 0 complete linkage (default algorithm) 1 single linkage 2 unweighted average linkage 3 weighted average linkage
Definition at line 31 of file ahc_classifier.cpp.
void AHCClassifier::clusterWithDistance | ( | const Matrix2D< double > & | D, |
int | numberOfClusters = 2 , |
||
int | linkageType = 1 |
||
) |
Cluster given a distance matrix. X is the data to classify, each row is an observation. Columns are features of that observation.
For linkage: 0 complete linkage (default algorithm) 1 single linkage 2 unweighted average linkage 3 weighted average linkage
Definition at line 71 of file ahc_classifier.cpp.
std::vector< std::vector<int> > AHCClassifier::cluster |
There are as many elements in the vector as clusters. Each vector in the cluster contains the list of individuals assigned to this cluster.
Definition at line 49 of file ahc_classifier.h.
Matrix1D<int> AHCClassifier::clusterAssigned |
The i-th location is the number of the cluster of the i-th element in the input data. The length of this vector is the number of individuals.
Definition at line 44 of file ahc_classifier.h.