AI::NaiveBayes::Classification - The result of a bayesian classification
version 0.04
my $result = $classifier->classify({bar => 3, blurp => 2}); # $result is an AI::NaiveBayes::Classification object say $result->best_category; my $predictors = $result->find_predictors;
AI::NaiveBayes::Classification represents the result of a bayesian classification, produced by AI::NaiveBayes classifier.
best_category()
Returns a string being a label that suits given document the best.
find_predictors()
This method returns the best_category(), as well as the list of all the predictors along with their influence on the best category selected. So the second value returned is a list of array references, where each one contains a string being a single feature and a number describing its influence on the result. So the second part of the result may look like this:
( [ 'activities', 1.2511540632952 ], [ 'over', -1.0269523272981 ], [ 'provide', 0.8280157033269 ], [ 'natural', 0.7361042359385 ], [ 'against', -0.6923354975173 ], )
AI::NaiveBayes (3), AI::Classifier(3)
Zbigniew Lukasiak <zlukasiak@opera.com>
Tadeusz Sośnierz <tsosnierz@opera.com>
Ken Williams <ken@mathforum.org>
This software is copyright (c) 2012 by Opera Software ASA.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install AI::NaiveBayes, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AI::NaiveBayes
CPAN shell
perl -MCPAN -e shell install AI::NaiveBayes
For more information on module installation, please visit the detailed CPAN module installation guide.