The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

AI::ANN - an artificial neural network simulator

VERSION

version 0.002

SYNOPSIS

use AI::ANN; my $network = new AI::ANN ( inputs => $inputcount, data => \@neuron_definition ); my $outputs = $network->execute( \@inputs );

METHODS

new

ANN::new({inputs => $inputcount, data => [{ iamanoutput => 0, inputs => {$inputid => $weight, ...}, neurons => {$neuronid => $weight}}, ...]})

inputs is number of inputs. data is an arrayref of neuron definitions. The first neuron with iamanoutput=1 is output 0. The second is output 1. I hope you're seeing the pattern... minvalue is the minimum value a neuron can pass. Default 0. maxvalue is the maximum value a neuron can pass. Default 1. afunc is a reference to the activation function. It should be simple and fast. The activation function is processed /before/ minvalue and maxvalue.

execute

$network->execute( [$input0, $input1, ...] )

Runs the network for as many iterations as necessary to achieve a stable network, then returns the output. We store the current state of the network in two places - once in the object, for persistence, and once in $neurons, for simplicity. This might be wrong, but I couldn't think of a better way.

get_state

$network->get_state()

Returns three arrayrefs, [$input0, ...], [$neuron0, ...], [$output0, ...], corresponding to the data from the last call to execute(). Intended primarily to assist with debugging.

get_input_count

$network->get_input_count()

Returns the number of inputs as a scalar.

get_minvalue

$network->get_minvalue()

Returns the minimum neuron value as a scalar.

get_maxvalue

$network->get_maxvalue()

Returns the maximum neuron value as a scalar.

get_afunc

$network->get_afunc()

Returns the activation function as a coderef.

get_internals

$network->get_internals()

Returns the weights in a not-human-consumable format.

readable

$network->readable()

Returns a human-friendly and diffable description of the network.

AUTHOR

Dan Collins <DCOLLINS@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2011 by Dan Collins.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007