Chad A Davis > Algorithm-Cluster-Thresh-0.05 > Algorithm::Cluster::Thresh

Download:
Algorithm-Cluster-Thresh-0.05.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.05   Source  

NAME ^

Algorithm::Cluster::Thresh - Adds thresholding to hierarchical clustering of Algorithm::Cluster

VERSION ^

version 0.05

SYNOPSIS ^

 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";

DESCRIPTION ^

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.

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.

NAME ^

Algorithm::Cluster::Thresh - Hierarchical clustering with variable thresholds

VERSION ^

version 0.05

SOURCE ^

 https://github.com/chadadavis/Algorithm-Cluster-Thresh

METHODS ^

cutthresh

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.

AUTHOR ^

Chad A. Davis <chad.a.davis@gmail.com>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: