PHP Classes

File: Procedural/index.php

Recommend this page to a friend!
  Classes of Rizza   PHP Neural Network Library   Procedural/index.php   Download  
File: Procedural/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Neural Network Library
Implements a multilayer perceptron neural network
Author: By
Last change:
Date: 3 years ago
Size: 654 bytes
 

Contents

Class file image Download
<?php
require_once(__DIR__."/classes/network.php");
$network=new \nn\network([2,2,2,1]);
set_time_limit(9001);
echo(
"<pre>");
for(
$i=0;$i<1000000;$i++){
   
$TSE=0;
    foreach([
        [[
0,0],[0]],
        [[
0,1],[1]],
        [[
1,0],[1]],
        [[
1,1],[0]]
    ] as
$test_vector){
       
$TSE+=$network->epoch($test_vector[0],$test_vector[1]);
       
    }
   
//print_r($TSE);
    //echo("<br/>");
}
//var_dump($network->activate([0.6]));
//var_dump($network);
foreach([
    [[
0,0],[0]],
    [[
0,1],[0]],
    [[
1,0],[0]],
    [[
1,1],[1]]
] as
$test_vector){
   
print_r($network->activate($test_vector[0]));
    echo(
"<br/>");
}
echo(
"</pre>");