AI-NeuralNet-Mesh
view release on metacpan or search on metacpan
examples/ex_alpha.pl view on Meta::CPAN
=begin
File: examples/ex_alpha.pl
Author: Josiah Bryan, <jdb@wcoil.com>
Desc:
This demonstrates the ability of a neural net to
generalize and predict what the correct result is
for inputs that it has never seen before.
This teaches the network to classify some twenty-
nine seperate 35-byte bitmaps, and then it inputs
an never-before-seen bitmap and displays the
classification the network gives for the unknown bitmap.
=cut
use AI::NeuralNet::Mesh;
# Create a new network with 35 neurons in input layer and 1 output neuron
my $net = new AI::NeuralNet::Mesh([
{
nodes => 35,
activation => linear
},
{
nodes => 1,
activation => linear,
}
]);
# Debug level of 4 gives JUST learn loop iteteration benchmark and comparrison data
# as learning progresses.
$net->debug(4);
my $letters = [ # All prototype inputs
[
0,1,1,1,0, # Inputs are
1,0,0,0,1, # 5*7 digitalized caracters
1,0,0,0,1,
1,1,1,1,1,
1,0,0,0,1, # This is the alphabet of the
1,0,0,0,1, # HP 28S
1,0,0,0,1,
],[0],[
1,1,1,1,0,
1,0,0,0,1,
1,0,0,0,1,
1,1,1,1,0,
1,0,0,0,1,
1,0,0,0,1,
1,1,1,1,0,
],[1],[
0,1,1,1,0,
1,0,0,0,1,
1,0,0,0,0,
1,0,0,0,0,
1,0,0,0,0,
1,0,0,0,1,
0,1,1,1,0,
],[2],[
1,1,1,0,0,
1,0,0,1,0,
1,0,0,0,1,
1,0,0,0,1,
1,0,0,0,1,
1,0,0,1,0,
1,1,1,0,0,
],[4],[
1,1,1,1,1,
1,0,0,0,0,
1,0,0,0,0,
1,1,1,1,0,
1,0,0,0,0,
1,0,0,0,0,
1,1,1,1,1,
],[5],[
1,1,1,1,1,
1,0,0,0,0,
1,0,0,0,0,
1,1,1,1,0,
1,0,0,0,0,
1,0,0,0,0,
1,0,0,0,0,
],[6],[
0,1,1,1,0,
1,0,0,0,1,
1,0,0,0,0,
1,0,0,0,0,
1,0,0,1,1,
1,0,0,0,1,
0,1,1,1,0,
( run in 0.786 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )