AI::NNFlex x square

[email protected] (Jim zaba) Fri, 18 Mar 2005 15:31:20 -0800 (PST)
Newsgroups perl.ai
Message-ID <[email protected]>
--0-472366151-1111188680=:99115
Content-Type: text/plain; charset=us-ascii


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! 
--0-472366151-1111188680=:99115--