Grokbase Groups Perl ai March 2005
FAQ
Hello,

I'm not sure what I messed up here.

Thanks,

-Jim

use strict;
use AI::NNFlex::momentum;
use AI::NNFlex::Dataset;

# Create the network

my $network = AI::NNFlex::momentum->new( learningrate=>.1,
bias=>1,
momentum=>0.6,
round=>1);

$network->add_layer( nodes=>1,
activationfunction=>"tanh");

$network->add_layer( nodes=>1,
activationfunction=>"tanh");

$network->add_layer( nodes=>1,
activationfunction=>"linear");

$network->init();

my $dataset = AI::NNFlex::Dataset->new([
[0],[0],
[1/3],[1/9],
[2/3],[4/9],
[9/3],[9/9]]);

my $counter=0;
my $err = 10;
while ($err >1.001)
{
$err = $dataset->learn($network);

print "Epoch $counter: Error = $err\n";
$counter++;

}


foreach (@{$dataset->run($network)})
{
foreach (@$_){print $_}
print "\n";



---------------------------------
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!

Search Discussions

  • Jim zaba at Mar 18, 2005 at 11:35 pm
    Hello,

    I'm not sure what I messed up here.

    Thanks,

    -Jim

    use strict;
    use AI::NNFlex::momentum;
    use AI::NNFlex::Dataset;

    # Create the network

    my $network = AI::NNFlex::momentum->new( learningrate=>.1,
    bias=>1,
    momentum=>0.6,
    round=>1);

    $network->add_layer( nodes=>1,
    activationfunction=>"tanh");

    $network->add_layer( nodes=>1,
    activationfunction=>"tanh");

    $network->add_layer( nodes=>1,
    activationfunction=>"linear");

    $network->init();

    my $dataset = AI::NNFlex::Dataset->new([
    [0],[0],
    [1/3],[1/9],
    [2/3],[4/9],
    [9/3],[9/9]]);

    my $counter=0;
    my $err = 10;
    while ($err >1.001)
    {
    $err = $dataset->learn($network);

    print "Epoch $counter: Error = $err\n";
    $counter++;

    }


    foreach (@{$dataset->run($network)})
    {
    foreach (@$_){print $_}
    print "\n";


    __________________________________________________
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupai @
categoriesperl
postedMar 18, '05 at 11:31p
activeMar 18, '05 at 11:35p
posts2
users1
websiteperl.org

1 user in discussion

Jim zaba: 2 posts

People

Translate

site design / logo © 2021 Grokbase