AI-NaiveBayes
view release on metacpan or search on metacpan
2345678910111213141516171819202122232425262728Installing 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.
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
727374757677787980818283848586878889909192# 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 => {
132133134135136137138139140141142143144145146147148149150151152=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
787980818283848586878889909192939495969798AI::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
138139140141142143144145146147148149150151152153154155156157158=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
9596979899100101102103104105106107108109110111112113114115__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
197198199200201202203204205206207This 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 )