Incorrect search filter: invalid characters - *.p[ml]
AI-DecisionTree

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

   hash reference, to check the attributes of the given instance.
   This allows lazy instance checking.

0.08  Mon Jul  7 18:01:16 CDT 2003

 - Added a 'leaf_color' parameter for making GraphViz objects more
   colorful.

0.07  Fri Jun  6 10:37:51 CDT 2003

 - Created tests for the set_results() and copy_instances() methods.

 - Added documentation for as_graphviz() and increased the information
   contained in the GraphViz object.

 - Added the ability to limit the absolute depth of the tree when
   training.

0.06  Wed Sep 18 13:59:24 EST 2002

 - Fixed an XS memory leak that was afflicting all training instances.
   Added tests to make sure leak stays plugged.

 - Added the 'purge' and 'verbose' parameters to new().

 - add_instance() now accepts a 'name' parameter.

 - Users can now control whether training instances are purged after
   training, using the 'purge' parameter to new() and/or the
   do_purge() method.

 - Added the set_results() and copy_instances() methods, which let you

Changes  view on Meta::CPAN

   decision tree.  All tree data is now stored as member data, not
   class data.

 - DecisionTree.pm is now pure-perl again (though Instance.pm still
   has an XS component).

 - Fixed a one-off bug in the Instance.xs code that could create
   garbage data.

 - Handles "sparse" data better.  Sparse data means that every
   attribute doesn't have to be defined for every training/test
   instance.  This can now be a meaningful property - the absence of a
   value is currently equivalent to a special "<undef>" value.

 - Don't trigger warnings when undefined attribute values are
   encountered (as happens with sparse data).

 - Added documentation for the 'prune' parameter to new()

 - More consistent with memory allocation in Instance.xs - uses the
   perl memory macros/functions from `perldoc perlclib` instead of raw

INSTALL  view on Meta::CPAN

Alternatively, if your CPAN shell is set up, you should just be able to do:

    % cpan AI::DecisionTree

## 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

Then install it:

    % make install

If you are installing into a system-wide directory, you may need to run:

    % sudo make install

## Documentation

Instance/Instance.pm  view on Meta::CPAN

  my $i = new AI::DecisionTree::Instance([3,5], 7, 'this_instance');
  $i->value_int(0) == 3;
  $i->value_int(1) == 5;
  $i->result_int == 7;

=head1 DESCRIPTION

This class is just a simple Perl wrapper around a C struct embodying a
single training instance.  Its purpose is to reduce memory usage.  In
a "typical" training set with about 1000 instances, memory usage can
be reduced by about a factor of 5 (from 43.7M to 8.2M in my test
program).

A fairly tight loop is also implemented that helps speed up the
C<train()> AI::DecisionTree method by about a constant factor of 4.

Please do not consider this interface stable - I change it whenever I
have a new need in AI::DecisionTree.

=head1 AUTHOR

Instance/t/01-basic.t  view on Meta::CPAN

#!/usr/bin/perl

use Test;
BEGIN { plan tests => 7 }

use AI::DecisionTree::Instance;
ok(1);

my $i = AI::DecisionTree::Instance->new([1, 2], 0, "foo");
ok $i->value_int(0), 1;
ok $i->value_int(1), 2;
ok $i->result_int, 0;

$i->set_value(0, 3);

Instance/t/02-leaktest.t  view on Meta::CPAN

#!/usr/bin/perl

use Test;
BEGIN { plan tests => 4 }

use AI::DecisionTree::Instance;
ok(1);

my $x = 0;
{
  local *{"AI::DecisionTree::Instance::DESTROY"} = sub { $x = 1 };
  {
    my $i = new AI::DecisionTree::Instance([3,4], 4, "foo");
    ok $x, 0;

LICENSE  view on Meta::CPAN

OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

                     END OF TERMS AND CONDITIONS

        Appendix: How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.

  To do so, attach the following notices to the program.  It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>

MANIFEST  view on Meta::CPAN

Changes
INSTALL
Instance/Instance.pm
Instance/Instance.xs
Instance/Makefile.PL
Instance/t/01-basic.t
Instance/t/02-leaktest.t
Instance/typemap
LICENSE
MANIFEST
META.yml
Makefile.PL
README
SIGNATURE
dist.ini
eg/example.pl
lib/AI/DecisionTree.pm

Makefile.PL  view on Meta::CPAN

  "EXE_FILES" => [],
  "LICENSE" => "perl",
  "NAME" => "AI::DecisionTree",
  "PREREQ_PM" => {
    "Carp" => 0,
    "GraphViz" => 0,
    "strict" => 0,
    "vars" => 0
  },
  "VERSION" => "0.11",
  "test" => {
    "TESTS" => "t/*.t"
  }
);


unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
  my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
  my $pp = $WriteMakefileArgs{PREREQ_PM};
  for my $mod ( keys %$br ) {
    if ( exists $pp->{$mod} ) {

SIGNATURE  view on Meta::CPAN


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

SHA1 e01a2ac643b28c7aa7d0d07a8185899a6aa32b13 Changes
SHA1 96da61eea928700509e1a616e036564035244a72 INSTALL
SHA1 7895b6323a97d46368eed8d0386db448d7e7dea0 Instance/Instance.pm
SHA1 98866c7c1b5c1bf6fd38b762ccb6bf6b053045df Instance/Instance.xs
SHA1 998f560a410f706d948b4bc373a99a00bea4f9ac Instance/Makefile.PL
SHA1 fe6397abc886b83d6f61f8efc9fd5d41a5d73ec6 Instance/t/01-basic.t
SHA1 2398adf915f9ac9383783ff279394f78138b805d Instance/t/02-leaktest.t
SHA1 57eae1c6196bbd84c32eb08e1b9db3b2d4e394b0 Instance/typemap
SHA1 b33df3650303ca968f350ac6a976f34f41762851 LICENSE
SHA1 7d2f601dbd1f9ae98ef59cacd828f7ce2675cd9c MANIFEST
SHA1 fc7255a5efe2c3b3cbc1bbb8f099e62f51cc9d5b META.yml
SHA1 f3f560a3566adacd46cab640a59fba80a910092c Makefile.PL
SHA1 812540cf2be2d26d622a363c9ea6fb76c3983995 README
SHA1 b5b9aafd9c2d8e21e669506b46a5e1f0387d0bcc dist.ini
SHA1 73ad1b764e8b3ca6cc3a204a4260e53f14cbc6a0 eg/example.pl
SHA1 d28b3d5fbbe669456f9f1c73d198d0be1dfaa872 lib/AI/DecisionTree.pm
SHA1 cc1fbcb2131905c9474ac2d38abac368dd1a5d20 t/01-simple.t

t/01-simple.t  view on Meta::CPAN

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'

#########################

use Test;
BEGIN { plan tests => 31 };
use AI::DecisionTree;
ok(1); # If we made it this far, we're ok.

#########################

my @attributes = qw(outlook  temperature  humidity  wind    play_tennis);               
my @cases      = qw(
		    sunny    hot          high      weak    no
		    sunny    hot          high      strong  no
		    overcast hot          high      weak    yes

t/01-simple.t  view on Meta::CPAN

  }
  foreach my $doc (@train) {
    $t2->add_instance( attributes => {map {$_,1} split ' ', $doc->[1]},
		       result => 0+($doc->[0] eq 'vampire'));
  }
  
  $t1->train;
  $t2->train;
  ok(1);

  my @test = (
	      [farming => 'I would like to begin farming sheep'],
	      [vampire => "I see that many vampires may have eaten my beautiful daughter's blood"],
	     );

  foreach my $doc (@test) {
    my $result = $t1->get_result( attributes => {map {$_,1} split ' ', $doc->[1]} );
    ok $result, 0+($doc->[0] eq 'farming');

    $result = $t2->get_result( attributes => {map {$_,1} split ' ', $doc->[1]} );
    ok $result, 0+($doc->[0] eq 'vampire');
  }

}

{

t/02-noisy.t  view on Meta::CPAN

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'

#########################

use Test;
BEGIN { plan tests => 5 };
use AI::DecisionTree;
ok(1); # If we made it this far, we're ok.

#########################

my $dtree = AI::DecisionTree->new(noise_mode => 'pick_best');
ok $dtree;

my @names = split /, /, <DATA>;
chomp $names[-1];

t/author-critic.t  view on Meta::CPAN

#!perl

BEGIN {
  unless ($ENV{AUTHOR_TESTING}) {
    require Test::More;
    Test::More::plan(skip_all => 'these tests are for testing by the author');
  }
}


use strict;
use warnings;

use Test::More;
use English qw(-no_match_vars);



( run in 1.639 second using v1.01-cache-2.11-cpan-87723dcf8b7 )