AI-NaiveBayes1

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

t/6-2.out
t/6-3.out
t/6-4.out
t/7.t
t/7-1.out
t/7-2.out
t/7-3.out
t/7-5.out
t/8.t
t/8-1.out
META.json                                Module JSON meta-data (added by MakeMaker)

NaiveBayes1.pm  view on Meta::CPAN

=item C<{real_stat}{$a}{$v}{$l}{sum}>

Statistics for real valued attributes; besides 'sum' also: count, mean, stddev

=item C<{numof_instances}>

Number of training instances.

=item C<{stat_labels}{$l}>

Label count in training data.

=item C<{stat_attributes}{$a}>

Statistics for an attribute: C<...{$value}{$label}> = count of
instances.

=item C<{smoothing}{$attribute}>

Attribute smoothing.  No smoothing if does not exist.  Implemented smoothing:

      - /^unseen count=/ followed by number, e.g., 0.5

=back

=head2 Attribute Smoothing

For an attribute A one can specify:

    $nb->{smoothing}{A} = 'unseen count=0.5';

to provide a count for unseen data.  The count is taken into
consideration in training and prediction, when any unseen attribute
values are observed.  Zero probabilities can be prevented in this way.
A count other than 0.5 can be provided, but if it is <=0 it will be
set to 0.5.  The method is similar to add-one smoothing.  A special
attribute value '*' is used for all unseen data. 

=head1 METHODS

=head2 Constructor Methods

=over 4

=item new()

Constructor. Creates a new C<AI::NaiveBayes1> object and returns it.

NaiveBayes1.pm  view on Meta::CPAN

book), page 86):

 # @relation weather
 # 
 # @attribute outlook {sunny, overcast, rainy}
 # @attribute temperature real
 # @attribute humidity real
 # @attribute windy {TRUE, FALSE}
 # @attribute play {yes, no}
 # 
 # @data
 # sunny,85,85,FALSE,no
 # sunny,80,90,TRUE,no
 # overcast,83,86,FALSE,yes
 # rainy,70,96,FALSE,yes
 # rainy,68,80,FALSE,yes
 # rainy,65,70,TRUE,no
 # overcast,64,65,TRUE,yes
 # sunny,72,95,FALSE,no
 # sunny,69,70,FALSE,yes
 # rainy,75,80,FALSE,yes

t/2.t  view on Meta::CPAN


my $nb = AI::NaiveBayes1->new;

# @relation spam-b
#
# @attribute morning {Y,N}
# @attribute html    {Y,N}
# @attribute size1   {S,L}
# @attribute spam    {Y,N}
#
# @data
# Y, N, S, N
# N, Y, L, Y
# Y, Y, L, Y
# N, Y, S, Y
# N, N, S, N
# Y, Y, L, Y
# Y, Y, L, N
# N, Y, L, Y
# N, Y, L, Y
# N, Y, S, Y

t/3.t  view on Meta::CPAN

# book), page82
#
# @relation weather.symbolic
# 
# @attribute outlook {sunny, overcast, rainy}
# @attribute temperature {hot, mild, cool}
# @attribute humidity {high, normal}
# @attribute windy {TRUE, FALSE}
# @attribute play {yes, no}
# 
# @data
# sunny,hot,high,FALSE,no
# sunny,hot,high,TRUE,no
# overcast,hot,high,FALSE,yes
# rainy,mild,high,FALSE,yes
# rainy,cool,normal,FALSE,yes
# rainy,cool,normal,TRUE,no
# overcast,cool,normal,TRUE,yes
# sunny,mild,high,FALSE,no
# sunny,cool,normal,FALSE,yes
# rainy,mild,normal,FALSE,yes

t/4.t  view on Meta::CPAN

# book), page 86
#
# @relation weather
# 
# @attribute outlook {sunny, overcast, rainy}
# @attribute temperature real
# @attribute humidity real
# @attribute windy {TRUE, FALSE}
# @attribute play {yes, no}
# 
# @data
# sunny,85,85,FALSE,no
# sunny,80,90,TRUE,no
# overcast,83,86,FALSE,yes
# rainy,70,96,FALSE,yes
# rainy,68,80,FALSE,yes
# rainy,65,70,TRUE,no
# overcast,64,65,TRUE,yes
# sunny,72,95,FALSE,no
# sunny,69,70,FALSE,yes
# rainy,75,80,FALSE,yes

t/5.t  view on Meta::CPAN


my $nb = AI::NaiveBayes1->new;

# @relation spam
#
# @attribute morning {Y,N}
# @attribute html    {Y,N}
# @attribute size    real
# @attribute spam    {Y,N}
#
# @data
# Y, N, 408, N
# N, Y, 3353, Y
# Y, Y, 4995, Y
# N, Y, 1853, Y
# N, N, 732, N
# Y, Y, 4017, Y
# Y, Y, 3190, N
# N, Y, 2345, Y
# N, Y, 3569, Y
# N, Y, 559, Y

t/a2.arff  view on Meta::CPAN

@relation spam-b

@attribute morning {Y,N}
@attribute html    {Y,N}
@attribute size1   {S,L}
@attribute spam    {Y,N}

@data
Y, N, S, N
N, Y, L, Y
Y, Y, L, Y
N, Y, S, Y
N, N, S, N
Y, Y, L, Y
Y, Y, L, N
N, Y, L, Y
N, Y, L, Y
N, Y, S, Y



( run in 0.440 second using v1.01-cache-2.11-cpan-8d75d55dd25 )