27 std::vector<std::string> metrics= {
"euclidean",
33 std::vector<std::string> linkages = {
"average",
38 for (
auto linkage: linkages)
39 for (
auto metric: metrics)
41 arma::mat data = arma::randu<arma::mat>(1024, 50);
42 for (
auto ahca: ahca_obj){
50 void TestAHCA::testCompleteClusters()
52 for (
auto ahca: ahca_obj){
53 arma::mat assignments = ahca.Cluster(15);
54 for (arma::uword i = 0; i < assignments.n_cols; ++i){
55 arma::uvec unique_values = arma::find_unique(assignments.col(i));
56 QCOMPARE((i + 1), unique_values.n_elem);
64 void TestAHCA::testExclusiveClusters()
66 for (
auto ahca: ahca_obj){
67 std::map<size_t, nodevec> clusters = ahca.clusters();
69 for (
size_t i = 1; i < 15; ++i){
70 nodevec current_clusters = clusters[i];
71 for (
auto current_cluster: current_clusters){
73 indices = current_cluster->GetChildIndices();
75 indices = arma::join_vert(indices, current_cluster->GetChildIndices());
77 arma::uvec unique_values = arma::find_unique(indices);
78 arma::uword unique_count = unique_values.n_rows;
79 QCOMPARE(unique_count, indices.n_rows);
std::vector< node_t * > nodevec
TestAHCA(QObject *parent)
The AHCA class Handles agglomerative hierarchical clustering of data This class holds a tree which re...