Algorithm-NaiveBayes
view release on metacpan or search on metacpan
lib/Algorithm/NaiveBayes/Model/Frequency.pm view on Meta::CPAN
package Algorithm::NaiveBayes::Model::Frequency;
use strict;
use Algorithm::NaiveBayes::Util qw(sum_hash add_hash max rescale);
use base qw(Algorithm::NaiveBayes);
sub new {
my $self = shift()->SUPER::new(@_);
$self->training_data->{attributes} = {};
$self->training_data->{labels} = {};
return $self;
}
sub do_add_instance {
my ($self, $attributes, $labels, $training_data) = @_;
add_hash($training_data->{attributes}, $attributes);
my $mylabels = $training_data->{labels};
( run in 1.039 second using v1.01-cache-2.11-cpan-49f99fa48dc )