AI-ANN
view release on metacpan or search on metacpan
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
lib/AI/ANN/Evolver.pm view on Meta::CPAN
if (abs($weight) < $self->{'mutation_amount'}) {
if (rand() < $self->{'kill_link_chance'}) {
$weight = undef;
}
}
} else {
if (rand() < $self->{'add_link_chance'}) {
$weight = rand() * $self->{'mutation_amount'};
# We want to Do The Right Thing. Here, that means to
# detect whether the user is using weights in (0, x), and
# if so make sure we don't accidentally give them a
# negative weight, because that will become 0.000001.
# Instead, we'll generate a positive only value at first
# (it's easier) and then, if the user will accept negative
# weights, we'll let that happen.
if ($self->{'min_value'} < 0) {
($weight *= 2) -= $self->{'mutation_amount'};
}
# Of course, we have to check to be sure...
if ($weight > $self->{'max_value'}) {
$weight = $self->{'max_value'};
lib/AI/ANN/Evolver.pm view on Meta::CPAN
if (rand() < $self->{'kill_link_chance'}) {
$weight = undef;
}
}
} else {
if (rand() < $self->{'add_link_chance'}) {
$weight = rand() * $self->{'mutation_amount'};
# We want to Do The Right Thing. Here, that means to
# detect whether the user is using weights in (0, x), and
# if so make sure we don't accidentally give them a
# negative weight, because that will become 0.000001.
# Instead, we'll generate a positive only value at first
# (it's easier) and then, if the user will accept negative
# weights, we'll let that happen.
if ($self->{'min_value'} < 0) {
($weight *= 2) -= $self->{'mutation_amount'};
}
# Of course, we have to check to be sure...
if ($weight > $self->{'max_value'}) {
$weight = $self->{'max_value'};
lib/AI/ANN/Evolver.pm view on Meta::CPAN
kill_link_chance is the chance that, during a mutate() call, each pair of
connected neurons with a weight less than mutation_amount or each
neuron => input pair with a weight less than mutation_amount will be
disconnected. If add_link_chance is zero, this should also be zero, or
your network will just fizzle out.
sub_crossover_chance is the chance that, during a crossover() call, each
neuron will, rather than being inherited fully from each parent, have
each element within it be inherited individually.
min_value is the smallest acceptable weight. It must be less than or equal to
zero. If a value would be decremented below min_value, it will instead
become an epsilon above min_value. This is so that we don't accidentally
set a weight to zero, thereby killing the link.
max_value is the largest acceptable weight. It must be greater than zero.
gaussian_tau and gaussian_tau_prime are the terms to the gaussian mutation
method. They are coderefs which accept one parameter, n, the number of
non-zero-weight inputs to the given neuron.
=head2 crossover
$evolver->crossover( $network1, $network2 )
( run in 0.421 second using v1.01-cache-2.11-cpan-de7293f3b23 )