AI::CBR::Sim - collection of basic similarity functions
Import similarity functions for case construction.
use AI::CBR::Sim qw(sim_dist sim_eq); ... ...
sim_dist
sim_frac
sim_eq
sim_set
Works for any numeric values. Suitable when you are interested into the difference of values in a given range. Returns the fraction of the difference of the values with respect to a given maximum range of interest. The madatory third argument is this range.
sim_dist(26, 22, 10); # returns 0.4 sim_dist(-2, 1, 100); # returns 0.03
Works for non-negative numeric values. Suitable when you are only interested into their relative difference with respect to 0. Returns the fraction of the smaller argument with respect to the higher one.
sim_frac(3, 2); # returns 0.67 sim_frac(40, 50); # returns 0.8
Works for any textual value. Suitable when you are interested only into equality/inequality. Returns 1 in case of equality, 0 in case of inequality. No third argument.
sim_eq('foo', 'bar'); # returns 0 sim_eq('foo', 'foo'); # returns 1
Works for sets/lists of textual values. Suitable when you are interested into overlap of the two sets. Arguments are two array references with textual values. Returns the number of elements in the intersection divided by the number of elements in the union. No third argument.
sim_set([qw/a b c/], [qw/b c d/]); # returns 0.5 sim_set([qw/a b c/], [qw/c/]); # returns 0.33
Darko Obradovic, <dobradovic at gmx.de>
<dobradovic at gmx.de>
Please report any bugs or feature requests to bug-ai-cbr-sim at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AI-CBR. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-ai-cbr-sim at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc AI::CBR::Case
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=AI-CBR
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/AI-CBR
CPAN Ratings
http://cpanratings.perl.org/d/AI-CBR
Search CPAN
http://search.cpan.org/dist/AI-CBR
Copyright 2009 Darko Obradovic, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install AI::CBR, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AI::CBR
CPAN shell
perl -MCPAN -e shell install AI::CBR
For more information on module installation, please visit the detailed CPAN module installation guide.