AI-NNFlex
view release on metacpan or search on metacpan
lib/AI/NNFlex/Feedforward.pm view on Meta::CPAN
# will have no effect, hence no if).
$node->{'activation'} -= $node->{'decay'};
my $nodeCounter=0;
foreach my $connectedNode (@{$node->{'connectedNodesWest'}->{'nodes'}})
{
if (scalar @debug> 0)
{$network->dbug("Flowing from ".$connectedNode->{'nodeid'}." to ".$node->{'nodeid'},3);}
my $weight = ${$node->{'connectedNodesWest'}->{'weights'}}[$nodeCounter];
my $activation = $connectedNode->{'activation'};
if (scalar @debug> 0)
{$network->dbug("Weight & activation: $weight - $activation",3);}
$totalActivation += $weight*$activation;
$nodeCounter++;
}
if ($node->{'active'})
{
my $value = $totalActivation;
my $function = $node->{'activationfunction'};
#my $functionCall ="\$value = \$network->$function(\$value);";
#eval($functionCall);
$value = $network->$function($value);
$node->{'activation'} = $value;
}
if (scalar @debug> 0)
{$network->dbug("Final activation of ".$node->{'nodeid'}." = ".$node->{'activation'},3);}
}
}
return $network->output;
}
1;
=pod
=head1 NAME
AI::NNFlex::Feedforward - methods for feedforward neural networks
=head1 SYNOPSIS
use AI::NNFlex::Feedforward;
$network->run([array of inputs]);
=head1 DESCRIPTION
AI::NNFlex::Feedforward provides a run method to flow activation through an NNFlex network in west to east feedforward style.
=head1 CONSTRUCTOR
None
=head1 METHODS
=head1 AI::NNFlex::Feedforward::run
takes an array of inputs for the network. Returns true or false.
=head1 SEE ALSO
AI::NNFlex
AI::NNFlex::Backprop
AI::NNFlex::Dataset
=head1 CHANGES
=head1 COPYRIGHT
Copyright (c) 2004-2005 Charles Colbourn. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
=head1 CONTACT
charlesc@nnflex.g0n.net
=cut
( run in 0.530 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )