Set::Partitions::SimilarityRoutines to measure similarity of partitions | |
Download |
Set::Partitions::Similarity Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Publisher Name:
- Jeff Kubina
- Publisher web site:
- http://search.cpan.org/~kubina/
Set::Partitions::Similarity Tags
Set::Partitions::Similarity Description
Routines to measure similarity of partitions A partition of a set is a collection of mutually disjoint subsets of the set whose union is the set. Set::Partitions::Similarity is a Perl module that provides routines that measure the accuracy and precision between two partitions of a set. The measures can assess the performance of a binary clustering algorithm by comparing the clusters the algorithm creates against the correct clusters of test data.SYNOPSIS use Set::Partitions::Similarity qw(getAccuracyAndPrecision); use Data::Dump qw(dump); # set elements are Perl strings, sets are array references # partitions are nested arrays. dump getAccuracyAndPrecision (,], ,]); # dumps: # ("0.5", "0.25") # a partition is equivalent to itself, even the empty partition. dump getAccuracyAndPrecision (, ], , ]); dump getAccuracyAndPrecision ([], []); # dumps: # (1, 1) # (1, 1) # accuracy and precision are symmetric functions. my ($p, $q) = (, ], , ]); dump getAccuracyAndPrecision ($p, $q); dump getAccuracyAndPrecision ($q, $p); # dumps: # ("0.333333333333333", "0.2") # ("0.333333333333333", "0.2") # checks partitions and throws an exception. eval { getAccuracyAndPrecision (], ], 1); }; warn $@ if $@; # dumps: # partitions are invalid, they have different set elements. Requirements: · Perl
Set::Partitions::Similarity Related Software