AI-NaiveBayes

 view release on metacpan or  search on metacpan

INSTALL  view on Meta::CPAN

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Installing AI-NaiveBayes is straightforward.
 
## Installation with cpanm
 
If you have cpanm, you only need one line:
 
    % cpanm AI::NaiveBayes
 
If it does not have permission to install modules to the current perl, cpanm
will automatically set up and install to a local::lib in your home directory.
See the local::lib documentation (https://metacpan.org/pod/local::lib) for
details on enabling it in your environment.
 
## Installing with the CPAN shell
 
Alternatively, if your CPAN shell is set up, you should just be able to do:
 
    % cpan AI::NaiveBayes
 
## Manual installation
 
As a last resort, you can manually install it. Download the tarball, untar it,
then build it:
 
    % perl Makefile.PL
    % make && make test

README.pod  view on Meta::CPAN

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 
# ABSTRACT: A Bayesian classifier
 
=encoding utf8
 
=head1 SYNOPSIS
 
    # AI::NaiveBayes objects are created by AI::NaiveBayes::Learner
    # but for quick start you can use the 'train' class method
    # that is a shortcut using default AI::NaiveBayes::Learner settings
 
    my $classifier = AI::NaiveBayes->train(
        {
            attributes => {
                sheep => 1, very => 1,  valuable => 1, farming => 1
            },
            labels => ['farming']
        },
        {
            attributes => {

README.pod  view on Meta::CPAN

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
=over 4
 
=item new( model => $model )
 
Internal. See L<AI::NaiveBayes::Learner> to learn how to create a C<AI::NaiveBayes>
classifier from training data.
 
=item train( LIST of HASHREFS )
 
Shortcut for creating a trained classifier using L<AI::NaiveBayes::Learner> default
settings.
Arguments are passed to the C<add_example> method of the L<AI::NaiveBayes::Learner>
object one by one.
 
=item classify( HASHREF )
 
Classifies a feature-vector of the form:
 
    { feature1 => weight1, feature2 => weight2, ... }
     
The result is a C<AI::NaiveBayes::Classification> object.

lib/AI/NaiveBayes.pm  view on Meta::CPAN

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
AI::NaiveBayes - A Bayesian classifier
 
=head1 VERSION
 
version 0.04
 
=head1 SYNOPSIS
 
    # AI::NaiveBayes objects are created by AI::NaiveBayes::Learner
    # but for quick start you can use the 'train' class method
    # that is a shortcut using default AI::NaiveBayes::Learner settings
 
    my $classifier = AI::NaiveBayes->train(
        {
            attributes => {
                sheep => 1, very => 1,  valuable => 1, farming => 1
            },
            labels => ['farming']
        },
        {
            attributes => {

lib/AI/NaiveBayes.pm  view on Meta::CPAN

138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
=over 4
 
=item new( model => $model )
 
Internal. See L<AI::NaiveBayes::Learner> to learn how to create a C<AI::NaiveBayes>
classifier from training data.
 
=item train( LIST of HASHREFS )
 
Shortcut for creating a trained classifier using L<AI::NaiveBayes::Learner> default
settings.
Arguments are passed to the C<add_example> method of the L<AI::NaiveBayes::Learner>
object one by one.
 
=item classify( HASHREF )
 
Classifies a feature-vector of the form:
 
    { feature1 => weight1, feature2 => weight2, ... }
 
The result is a C<AI::NaiveBayes::Classification> object.

lib/AI/NaiveBayes/Learner.pm  view on Meta::CPAN

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
__PACKAGE__->meta->make_immutable;
 
1;
 
=pod
 
=encoding UTF-8
 
=head1 NAME
 
AI::NaiveBayes::Learner - Build AI::NaiveBayes classifier from a set of training examples.
 
=head1 VERSION
 
version 0.04
 
=head1 SYNOPSIS
 
    my $learner = AI::NaiveBayes::Learner->new(features_kept => 0.5);
    $learner->add_example(
        attributes => { sheep => 1, very => 1, valuable => 1, farming => 1 },

lib/AI/NaiveBayes/Learner.pm  view on Meta::CPAN

197
198
199
200
201
202
203
204
205
206
207
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.
 
=cut
 
__END__
 
# ABSTRACT: Build AI::NaiveBayes classifier from a set of training examples.



( run in 0.558 second using v1.01-cache-2.11-cpan-26ccb49234f )