AI-NeuralNet-Simple
view release on metacpan or search on metacpan
lib/AI/NeuralNet/Simple.pm view on Meta::CPAN
my ( $class, @args ) = @_;
logdie "you must supply three positive integers to new()"
unless 3 == @args;
foreach (@args) {
logdie "arguments to new() must be positive integers"
unless defined $_ && /^\d+$/;
}
my $seed = rand(1); # Perl invokes srand() on first call to rand()
my $handle = c_new_network(@args);
logdie "could not create new network" unless $handle >= 0;
my $self = bless {
input => $args[0],
hidden => $args[1],
output => $args[2],
handle => $handle,
}, $class;
$self->iterations(10000); # set a reasonable default
}
sub train {
my ( $self, $inputref, $outputref ) = @_;
( run in 0.871 second using v1.01-cache-2.11-cpan-de7293f3b23 )