Redis::Bayes - stochastic Baysian classification on Redis
EXAMPLES:
my $rb = Redis::Bayes->new; $rb->train('apple_computer',q{I'm going to pick up a new retina display MacBook!}); $rb->train('apple_fruit',q{That thing is rotten at the seeds.}); my $result = $rb->classify("retina display");
This module is an implementation of naive Bayes on Redis.
my $rb = Redis::Bayes->new; # defaults to Redis->new(reconnect => 2, every => 100); # or my $rb = Redis::Bayes->new( prefix => 'yourownprefixhere:', stopwords => {blah => 1, whatever => 1}, redis => $redis, );
Redis database prefix. The default is 'bayes:'.
The set of words to filter when training. The default uses Lingua::StopWords.
Defaults to Redis->new(reconnect => 2, every => 100). Otherwise, use delegation here.
$rb->train('apple','sauce');
Train using <label, document>.
$rb->untrain('apple','sauce');
Untrains <label, document>.
$rb->flush;
Flushes all trained data.
$rb->classify(q{there's a computer on the desk});
Returns the label with the highest confidence metric for the given document.
Redis
This module is ported loosely from other such packages in node and python, i.e. https://github.com/harthur/classifier and https://github.com/jart/redisbayes and https://github.com/didip/bayes_on_redis, with some modifications.
Andrew Shapiro, <trski@cpan.org>
<trski@cpan.org>
Please report any bugs or feature requests to bug-redis-bayes at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Redis-Bayes. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-redis-bayes at rt.cpan.org
Copyright 2013 Andrew Shapiro.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information.
To install Redis::Bayes, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Redis::Bayes
CPAN shell
perl -MCPAN -e shell install Redis::Bayes
For more information on module installation, please visit the detailed CPAN module installation guide.