AI-NaiveBayes

 view release on metacpan or  search on metacpan

t/default_training.t  view on Meta::CPAN

use strict;
use Test::More tests => 2;
use AI::NaiveBayes;
ok(1); # If we made it this far, we're loaded.

my $classifier = AI::NaiveBayes->train( 
    {
        attributes => _hash(qw(sheep very valuable farming)),
        labels => ['farming']
    },
    {
        attributes => _hash(qw(vampires cannot see their images mirrors)),
        labels => ['vampire']
    },
);

isa_ok( $classifier, 'AI::NaiveBayes' );


################################################################
sub _hash { +{ map {$_,1} @_ } }

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.459 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )