2017 © Pedro Peláez
 

library brainy

Neural network implementation in PHP, packaged for Composer.

image

lambdacasserole/brainy

Neural network implementation in PHP, packaged for Composer.

  • Tuesday, March 21, 2017
  • by lambdacasserole
  • Repository
  • 1 Watchers
  • 1 Stars
  • 22 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Brainy

Neural network implementation in PHP, packaged for Composer., (*1)

Based heavily on the Tremani neural network by Edward Akerboom but stripped down, tidied up and packaged for Composer., (*2)

Installation

Install Brainy via Composer like this:, (*3)

composer require lambdacasserole/brainy

Or alternatively, if you're using the PHAR (make sure the php.exe executable is in your PATH):, (*4)

php composer.phar require lambdacasserole/brainy

Usage

Create a new neural network instance like this:, (*5)

// Create a new neural network with 3 input neurons, one layer of 4 hidden neurons, and 1 output neuron.
$network = new NeuralNetwork(3, 4, 1);

Add training data to your new network thusly:, (*6)

// Add training data to the network. In this case, we want the network to learn the 'XOR' function.
$network->addTrainingData([-1, -1, 1], [-1]);
$network->addTrainingData([-1, 1, 1], [1]);
$network->addTrainingData([1, -1, 1], [1]);
$network->addTrainingData([1, 1, 1], [-1]);

Then begin training:, (*7)

// Train in a maximum of 1000 epochs to a maximum error rate of 0.01.
$success = $network->train(1000, 0.01);

Now put it to work:, (*8)

$output = $network->calculate([-1, -1, 1]); // Gives [-1].
$output = $network->calculate([-1, 1, 1]); // Gives [1].

Compatibility

Uses new array syntax and splats, so won't work on any PHP versions earlier than 5.6., (*9)

Further Reading

The original repository contains more comprehensive documentation, though it may need adjusting slightly due to modifications made to it in this version., (*10)

The Versions

21/03 2017

dev-master

9999999-dev

Neural network implementation in PHP, packaged for Composer.

  Sources   Download

BSD-3-Clause

30/01 2017

v1.3

1.3.0.0

Neural network implementation in PHP, packaged for Composer.

  Sources   Download

BSD-3-Clause

30/01 2017

v1.2

1.2.0.0

Neural network implementation in PHP, packaged for Composer.

  Sources   Download

BSD-3-Clause

30/01 2017

v1.1

1.1.0.0

Neural network implementation in PHP, packaged for Composer.

  Sources   Download

BSD-3-Clause

30/01 2017

v1.0

1.0.0.0

Neural network implementation in PHP, packaged for Composer.

  Sources   Download

BSD-3-Clause