Logging network weights: Difference between revisions

From Artificial Neural Network for PHP
No edit summary
No edit summary
Line 33: Line 33:
$network->setOutputs($outputs);
$network->setOutputs($outputs);


$network->logToFile('network.csv'); // Logging starten
$network->logToFile('network.csv'); // Start logging


$network->train();
$network->train();

Revision as of 20:57, 6 January 2008

Logging network weights while training

require_once 'ANN/ANN_Network.php';

try
{
  $network = ANN_Network::loadFromFile('xor.dat');
}
catch(Exception $e)
{
  print 'Creating a new one...';
	
  $network = new ANN_Network;
}

$inputs = array(
	array(0, 0),
	array(0, 1),
	array(1, 0),
	array(1, 1)
);

$outputs = array(
	array(0),
	array(1),
	array(1),
	array(0)
);

$network->setInputs($inputs);

$network->setOutputs($outputs);

$network->logToFile('network.csv'); // Start logging

$network->train();

$network->saveToFile('xor.dat');