AI-FANN-Evolving
view release on metacpan or search on metacpan
script/aivolver view on Meta::CPAN
'ignore' => $data{'ignore'},
);
my ( $traindata, $testdata );
if ( $data{'type'} and lc $data{'type'} eq 'continuous' ) {
( $traindata, $testdata ) = $inputdata->sample_data( $data{'fraction'} );
}
else {
( $traindata, $testdata ) = $inputdata->partition_data( $data{'fraction'} );
}
$log->info("number of training data records: ".$traindata->size);
$log->info("number of test data records: ".$testdata->size);
# create first work dir
my $wd = delete $experiment{'workdir'};
make_path($wd);
$wd .= '/0';
# create the experiment
my $exp = AI::FANN::Evolving::Experiment->new(
'traindata' => $traindata->to_fann,
'env' => $testdata->to_fann,
'workdir' => $wd,
%experiment,
);
# initialize the experiment
$exp->initialize(%initialize);
# run!
my ( $fittest, $fitness ) = $exp->run();
$log->info("*** overall best fitness: $fitness");
my ($gene) = sort { $a->fitness <=> $b->fitness } map { $_->genes } $fittest->chromosomes;
$gene->ann->save($outfile);
__END__
=pod
=head1 NAME
aivolver - Evolves optimal artificial neural networks
=head1 SYNOPSIS
aivolver [<config.yml>] [OPTION]...
try `aivolver --help' or `aivolver --manual' for more information
=head1 OPTIONS AND ARGUMENTS
B<***NO LONGER ACCURATE, CONSULT THE YAML CONFIG FILES***>
=over
=item B<<config.ymlE<gt>>
If the first command line argument is a file location, this will be interpreted as the
location of a configuration file in YAML syntax structured as in this
example: L<https://raw.github.com/naturalis/ai-fann-evolving/master/examples/conf.yml>.
Subsequent command line arguments can then be provided that override the defaults in this
configuration file.
=item B<-h/--help/-?>
Prints help message and exits.
=item B<-m/--manual>
Prints manual page and exits.
=item B<-v/--verbose>
Increments verbosity of the process. Can be used multiple times.
=item B<-o/--outfile <file.annE<gt>>
File name for the fittest ANN file over all generations.
=item B<-d/--data <key=valueE<gt>>
The C<data> argument is used multiple times, each time followed by a key/value pair
that defines the location of one of the data files. The key/value pairs are as follows:
=over
=item B<file=<data.tsvE<gt>>
Defines the location of a file of input data.
=item B<fraction=<numberE<gt>>
Fraction of input data to use for training (versus testing).
=back
=item B<-i/--initialize <key=valueE<gt>>
The C<initialize> argument is used multiple times, each time followed by a key/value
pair that defines one of the initialization settings for the (genetic) structure of the
evolving population. The key/value pairs are as follows:
=over
=item B<individual_count=<countE<gt>>
Defines the number of individuals in the population.
=item B<chromosome_count=<countE<gt>>
Defines the number of non-homologous chromosomes (i.e. n for diploid org). Normally
1 chromosome suffices.
=item B<gene_count=<countE<gt>>
Defines the number of genes per chromosome. Normally 1 gene (i.e. 1 ANN) suffices.
=back
=item B<-e/--experiment <key=valueE<gt>>
( run in 3.073 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )