AI-ANN

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.004     2011-05-31 02:35:26 UTC
          Minor calling changes that I need to commit so I can test them with 
          another module.

0.003     2011-05-31 01:09:32 UTC
          Minor. Correct the perl version requirement.

0.002     2011-05-31 01:04:53 UTC
          Make many obvious (to a computer, I hope) references to the fact 
          that this requires perl 5.14, to prevent the bloody annoying 
          CPAN Testers emails. Note that I chose to do this rather than 
          make the module compatible with earlier versions.

          Add two parameters for min and max neuron output values, default to 
          0 and 1. Conveniently, forget to actually implement that. 

          Less conveniently, remember to implement the above.
          
          While implementing the above, also implement an activation function 
          in the form of a coderef passed to the AI::ANN constructor.
          

dist.ini  view on Meta::CPAN

Storable = 0
Math::Libm = 0
Moose = 2.00
Inline::C = 0

[GatherDir]
[PruneCruft]
[ManifestSkip]
[MetaYAML]
[Readme]
[ExtraTests]
[ExecDir]
[ShareDir]
[MakeMaker]
[Manifest]
[TestRelease]
[ConfirmRelease]
[UploadToCPAN]


[PkgVersion]
[NextRelease]
time_zone = UTC

[PodWeaver]
[PodCoverageTests]
[PodSyntaxTests]

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

two networks. You will also, depending on your application, need a fitness 
function of some sort, in order to determine which networks to allow to 
propagate. Here is an example of that system.

use AI::ANN;
my $network = new AI::ANN ( input_count => $inputcount, data => \@neuron_definition );
my $outputs = $network->execute( \@inputs ); # Basic network use
use AI::ANN::Evolver;
my $handofgod = new AI::ANN::Evolver (); # See that module for calling details
my $network2 = $handofgod->mutate($network); # Random mutations
# Test an entire 'generation' of networks, and let $network and $network2 be
# among those with the highest fitness function in the generation.
my $network3 = $handofgod->crossover($network, $network2);
# Perhaps mutate() each network either before or after the crossover to 
# introduce variety.

We elected to do this with a new module rather than by extending an existing 
module because of the extensive differences in the internal structure and the 
interface that were necessary to accomplish these goals. 

=head1 METHODS

t/00_initialize.t  view on Meta::CPAN

# change 'tests => 1' to 'tests => last_test_to_print';

use Test::More tests => 9;
BEGIN { use_ok('AI::ANN');
	use_ok('AI::ANN::Neuron');
	use_ok('AI::ANN::Evolver'); };

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

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

$network=new AI::ANN ('inputs' => 1, 'data' => [{ iamanoutput => 1, inputs => {0 => 1}, neurons => {}}]);

ok(defined $network, "new() works");
ok($network->isa("AI::ANN"), "Right class");

$neuron=new AI::ANN::Neuron (0, {0 => 1}, {});

ok(defined $neuron, "new() works");
ok($neuron->isa("AI::ANN::Neuron"), "Right class");

t/01_neuron_basic.t  view on Meta::CPAN

# change 'tests => 1' to 'tests => last_test_to_print';

use Test::More tests => 17;
BEGIN { use_ok('AI::ANN');
	use_ok('AI::ANN::Neuron'); };

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

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

$neuron = new AI::ANN::Neuron(0, {0 => 1}, {});
ok(defined $neuron, "new() works");
ok($neuron->isa("AI::ANN::Neuron"), "Right class");

is($neuron->ready([1], {}), 1, "Ready - simplest case");
is($neuron->execute([1], {}), 1, "Execute - simplest case");

is($neuron->ready([], {}), 0, "Not ready - missing input");

t/02_network_basic.t  view on Meta::CPAN

# change 'tests => 1' to 'tests => last_test_to_print';

use Test::More tests => 25;
BEGIN { use_ok('AI::ANN');
	use_ok('AI::ANN::Neuron'); };

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

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

$network=new AI::ANN ('inputs'=>1, 'data'=>[{ iamanoutput => 1, inputs => {0 => 1}, neurons => {}}], 'maxvalue' => 10);

ok(defined $network, "new() works");
ok($network->isa("AI::ANN"), "Right class");

ok($out=$network->execute([1]), "executed and still alive");

is($#{$out}, 0, "execute() output for a single neuron is the right length");
is($out->[0], 1, "execute() output for a single neuron has the correct value");

t/03_evolver_basic.t  view on Meta::CPAN

# change 'tests => 1' to 'tests => last_test_to_print';

use Test::More tests => 60;
BEGIN { use_ok('AI::ANN');
	use_ok('AI::ANN::Evolver'); };

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

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

# This test basically works by crossing a network with itself and making sure nothing changes

$network1=new AI::ANN ('inputs'=>1, 'data'=>[{ iamanoutput => 1, inputs => {0 => 1}, neurons => {}}]);
$network2=new AI::ANN ('inputs'=>1, 'data'=>[{ iamanoutput => 1, inputs => {0 => 1}, neurons => {}}]);

ok(defined $network1, "new() works");
ok($network1->isa("AI::ANN"), "Right class");
ok(defined $network2, "new() works");
ok($network2->isa("AI::ANN"), "Right class");

t/10_network_integrity.t  view on Meta::CPAN

# change 'tests => 1' to 'tests => last_test_to_print';

use Test::More tests => 10;
BEGIN { use_ok('AI::ANN');
	use_ok('AI::ANN::Neuron'); };

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

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

$network=new AI::ANN ('inputs'=>1, 'data'=>[{ iamanoutput => 0, inputs => {0 => 2}, neurons => {}},
                       { iamanoutput => 1, inputs => {}, neurons => {0 => 2}}], 'maxvalue' => 10);

ok(defined $network, "new() works");
ok($network->isa("AI::ANN"), "Right class");

ok($out=$network->execute([1]), "executed and still alive");

is($#{$out}, 0, "execute() output for two neurons is the right length");

t/release-pod-coverage.t  view on Meta::CPAN

#!perl

BEGIN {
  unless ($ENV{RELEASE_TESTING}) {
    require Test::More;
    Test::More::plan(skip_all => 'these tests are for release candidate testing');
  }
}


use Test::More;

eval "use Test::Pod::Coverage 1.08";
plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage"
  if $@;

eval "use Pod::Coverage::TrustPod";
plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage"
  if $@;

all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });

t/release-pod-syntax.t  view on Meta::CPAN

#!perl

BEGIN {
  unless ($ENV{RELEASE_TESTING}) {
    require Test::More;
    Test::More::plan(skip_all => 'these tests are for release candidate testing');
  }
}

use Test::More;

eval "use Test::Pod 1.41";
plan skip_all => "Test::Pod 1.41 required for testing POD" if $@;

all_pod_files_ok();

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.779 second using v1.00-cache-2.02-grep-82fe00e-cpan-585fae043c8 )