Algorithm::Cluster::Thresh - Adds thresholding to hierarchical clustering of Algorithm::Cluster
version 0.05
use Algorithm::Cluster::Thresh; # Assuming you have a lower diagonal distance matrix ... # See L<Algorithm::Cluster> and / or L<Algorithm::DistanceMatrix> my $distmatrix; use Algorithm::Cluster qw/treecluster/; my $tree = treecluster(data=>$distmatrix, method=>'a'); # 'a'verage linkage # Get your objects and the cluster IDs they belong to # Clusters are within 5.5 of each other (based on average linkage here) my $cluster_ids = $tree->cutthresh(5.5); # Index corresponds to that of the original objects print 'Object 2 belongs to cluster number ', $cluster_ids->[2], "\n";
This is a small helper package for Algorithm::Cluster, but not an official part of it. That manual can be found here:
http://cpansearch.perl.org/src/MDEHOON/Algorithm-Cluster-1.48/doc/cluster.pdf
This package adds a simple method $tree-cutthresh(5.5)> to permit clustering by thresholds, rather than by needing to pre-define the number of clusters to be created.
$tree-
This is a Pure Perl module. It's not as efficient as the XS approach, which has already been submitted as a patch:
https://rt.cpan.org/Public/Bug/Display.html?id=68482
In the meantime, this module provides a Pure Perl implementation.
Algorithm::Cluster::Thresh - Hierarchical clustering with variable thresholds
https://github.com/chadadavis/Algorithm-Cluster-Thresh
Returns an array, where the value of each array element is the integer cluster ID of that object.
Returns a reference to the array in scalar context.
Chad A. Davis <chad.a.davis@gmail.com>
This software is copyright (c) 2011 by Chad A. Davis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Algorithm::Cluster::Thresh, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Algorithm::Cluster::Thresh
CPAN shell
perl -MCPAN -e shell install Algorithm::Cluster::Thresh
For more information on module installation, please visit the detailed CPAN module installation guide.