Set::Similarity::CosinePDL - Cosine similarity for sets PDL implementation
use Set::Similarity::CosinePDL; # object method my $cosine = Set::Similarity::CosinePDL->new; my $similarity = $cosine->similarity('Photographer','Fotograf');
A intersection B / (sqrt(A) * sqrt(B))
Set::Similarity::CosinePDL inherits all methods from Set::Similarity and implements the following new ones.
my $similarity = $object->from_sets(['a'],['b']);
This method expects two arrayrefs of strings as parameters. The parameters are not checked, thus can lead to funny results or uncatched divisions by zero.
If you want to use this method directly, you should take care that the elements are unique. Also you should catch the situation where one of the arrayrefs is empty (similarity is 0), or both are empty (similarity is 1).
http://github.com/wollmers/Set-Similarity-CosinePDL
Helmut Wollmersdorfer, <helmut.wollmersdorfer@gmail.com>
Copyright (C) 2013-2020 by Helmut Wollmersdorfer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Set::Similarity::CosinePDL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Set::Similarity::CosinePDL
CPAN shell
perl -MCPAN -e shell install Set::Similarity::CosinePDL
For more information on module installation, please visit the detailed CPAN module installation guide.