AI-ANN

 view release on metacpan or  search on metacpan

ANN_specification  view on Meta::CPAN

ANN
	implements an artificial neural network
	from caller, $network = new ANN( $inputcount, [{ iamanoutput => 0, inputs => {$inputid => $weight, ...}, neurons => {$neuronid => $weight}}, ...])
	from caller, $network->execute( [$input0, $input1, ...] ) runs the network with the provided inputs and returns the outputs as an arrayref
	from caller, $network->get_state() returns three arrayrefs, [$input0, ...], [$neuron0, ...], [$output0, ...]
	from caller, $network->get_input_count() returns the number of inputs
	from caller, $network->get_internals() returns the original arrayref format - for the evolver, perhaps
	from caller, $network->readable() returns a text-based human-readable and diffable description of the network:
		Neuron 0:
			Input from input 0, weight is 0.34232
			Input from input 1, weight is -0.21231
			Input from neuron 21, weight is 0.3213
			This neuron is a network output
	it should be noted that the network need not be feed-forward. ANN should use $self->{'network'}->ready() to determine if input conditions are satisfied. If it is impossible to complete the run by using ready(), then the network should store a list o...

ANN::Neuron
	implements an individual neuron from the neural network
	from ann, $self->{'network'}->[$n]->{'object'} = new ANN::Neuron( $thisid, {$inputid => $weight, ...}, {$neuronid => $weight})
	from ann, $self->{'network'}->[$n]->{'object'}->ready( [$input0, $input1, ...], {$neuronid => $neuronvalue, ...} ) returns 1 if all inputs are available, 0 otherwise
	from ann, $self->{'network'}->[$n]->{'object'}->execute( [$input0, $input1, ...], {$neuronid => $neuronvalue, ...} ) returns the output value of the neuron
	in addition, get_inputs and get_neurons are available. There return the respective original hashrefs. 

ANN::Evolver
	evolves the ann
	from caller, $handofgod = new ANN::Evolver({$mutationchance, $mutationamount, $addlinkchance, $killlinkchance, $subcrossoverchance}) add should be zero if you want to preserve feed-forwardness
	from caller, $handofgod->crossover($network1, $network2) returns $network3, which inherits 50% of each parent's traits. Each neuron has $subcrossoverchance to inherit 50% of its traits from each parent.
	from caller, $handofgod->mutate($network3) introduces some random mutations into neuron weights. Has a $mutationchance to change each weight by up to $mutationamount, a $addlinkchance to change an input from zero to up to $mutationamount, and a $kil...

ANN::SimWorld
	uses an ANN object to attempt to survive in a virtual world, which must be defined by the caller
	from caller, $world = new ANN::SimWorld( //stuff here )

Changes  view on Meta::CPAN

          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.
          
          Add the Evolver module, and tests for it. Ensure that the AI::ANN
          objects that Evolver returns have the same parameters as did the 
          original.

          Chase down a few bugs caused by a combination of evil references
          and me changing the structure of my objects halfway through coding.
          
          Yell at myself a little bit for taunting the ghost of the (not yet 
          dead) Larry Wall, by claiming that I was 'halfway through coding'.

0.001     2011-05-27 03:04:06 UTC
          Initial release. ANN and ANN::Neuron working, basic test suite and
          documentation.

gpl.txt  view on Meta::CPAN

add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for

gpl.txt  view on Meta::CPAN

occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the

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

You probably don't want to do this. This is the least effective way to evolve 
    neural networks. This is because, due to the hidden intermediate steps, it 
    is possible for two networks which output exactly the same with completely
    different internal representations.

=head2 mutate

$evolver->mutate($network)

Returns a version of $network mutated according to the parameters set for 
	$evolver, followed by a series of counters. The original is not modified. 
	The counters are, in order, the number of times we compared against the 
	following thresholds: mutation_chance, kill_link_chance, add_link_chance. 
	This is useful if you want to try to normalize your probabilities. For 
	example, if you want to make links be killed about as often as they are 
	added, keep a running total of the counters, and let:
	$kill_link_chance = $add_link_chance * $add_link_counter / $kill_link_counter
	This will probably make kill_link_chance much larger than add_link_chance, 
	but in doing so will make links be added at overall the same rate as they 
	are killed. Since new links tend to be killed particularly quickly, it may 
	be wise to add an additional optional multiplier to mutation_amount just 



( run in 0.366 second using v1.01-cache-2.11-cpan-f985c23238c )