AI-NaiveBayes1
view release on metacpan or search on metacpan
environment to reproduce)
- made Changes reverse chronological
2.008 Fri May 21 10:56:33 ADT 2021
- GitHub release
- documentation improvements
2.007 Wed Jan 29 05:58:37 AST 2020
- documentation update
- fixed bug: import_from_YAML and import_from_YAML_file now
return bless-ed references (they did not return before)
2.006 Tue Mar 15 06:17:04 ADT 2011
- reduced precision in \d{4}.\d+ to \d{4}.\d{10} avoid testing
problems on different platforms
2.005 Tue Mar 8 06:35:43 AST 2011
- reduced precision in comparison to avoid testing problems on
different platforms (from 14 to 12 digits after decimal point)
2.004 Sat Mar 5 12:39:35 AST 2011
NaiveBayes1.pm view on Meta::CPAN
use vars qw($Version);
$Version = $VERSION = '2.012';
use vars @EXPORT_OK;
# non-exported package globals go here
use vars qw();
sub new {
my $package = shift;
return bless {
attributes => [ ],
labels => [ ],
attvals => {},
real_stat => {},
numof_instances => 0,
stat_labels => {},
stat_attributes => {},
smoothing => {},
attribute_type => {},
}, $package;
NaiveBayes1.pm view on Meta::CPAN
sub set_real {
my ($self, @attr) = @_;
foreach my $a (@attr) { $self->{attribute_type}{$a} = 'real' }
}
sub import_from_YAML {
my $package = shift;
my $yaml = shift;
my $self = YAML::Load($yaml);
return bless $self, $package;
}
sub import_from_YAML_file {
my $package = shift;
my $yamlf = shift;
my $self = YAML::LoadFile($yamlf);
return bless $self, $package;
}
# assume that the last header count means counts
# after optionally removing counts, the last header is label
sub add_table {
my $self = shift;
my @atts = (); my $lbl=''; my $cnt = '';
while (@_) {
my $table = shift;
if ($table =~ /^(.*)\n[ \t]*-+\n/) {
( run in 1.300 second using v1.01-cache-2.11-cpan-de7293f3b23 )