Algorithm-DistanceMatrix
view release on metacpan or search on metacpan
lib/Algorithm/DistanceMatrix.pm view on Meta::CPAN
=head2 metric
Callback for computing the distance, similarity, or whatever measure you like.
$matrix->metric(\@mydistance);
Where C<mydistance> receives two objects as it's first two arguments.
If you need to pass special parameters to your method:
$matrix->metric(sub{my($x,$y)=@_;mydistance(first=>$x,second=>$y,mode=>'fast')};
You may use any metric, and may return any number or object. Note that if you
plan to use this with L<Algorithm::Cluster> this needs to be a distance metric.
So, if you're measure how similar two things are, on a scale of 1-10, then you
should return C<10-$similarity> to get a distance.
Default is the absolute values of the scalar difference (i.e. C<abs(X-Y)>)
=head2 objects
( run in 0.603 second using v1.01-cache-2.11-cpan-39bf76dae61 )