Main Page

From ANN - Artificial Neural Network for PHP 5
Jump to: navigation, search

ANN - Artificial Neural Network for PHP 5.x

This project realizes a neural network topology called multilayer perceptron for PHP 5.x environments. The source code is based on a work by Eddy Young in 2002. Several improvements and changes on this implementation are done by Thomas Wien ( - Düsseldorf - Germany) since 2007. You will find the PHP source in the section Download. Please, consider the Copyright. To get a short idea what is the benefit of neural networks have a look at page Neural Networks.

If you want to support the current and future development of this project I would appreciate if you donate a freely amount via paypal.

Donate now



  • Output type detection (linear or binary)
  • Logging (weights and network errors)
  • Client-Server model for distributed applications
  • Graphical network topology as PNG image
  • Displaying network details
  • String association
  • Classification
  • Phar support (as of PHP 5.3.0)

Versions and Change-Log

Version 2.x.x by Thomas Wien (Development)

  • Image matrix support
Version 2.3.0 by Thomas Wien (2012-12-13) Download
* Using traits for performance reasons
* Checking php version for compatibility with ANN library
* PHP 5.4.x or above

Version 2.2.3 by Thomas Wien (2012-12-12) Download

  • Bugfix: Division by zero if training time below one second
  • Adding php version and sapi interface to network information
  • Test running on PHP 5.4

Version 2.2.2 by Thomas Wien (2011-07-04)

  • Redesign of network details
  • Considering cpu limits for calculation of network execution time

Version 2.2.1 by Thomas Wien (2011-06-15)

  • Bug fix: Wrong output type detection in binary networks
  • Using Interface called \ANN\InterfaceLoadable to make easier decision of loadable objects.

Version 2.2.0 by Thomas Wien (2011-06-01)

  • Introduction of namespaces as of PHP 5.3
  • Dynamic learning rate
  • \ANN\Network::setLearningRate() is protected now
  • Bug fix: Wrong output type detection in some circumstances

Version 2.1.7 by Thomas Wien (2011-06-15) Download

  • Bug fix: Wrong output type detection in binary networks

Version 2.1.6 by Thomas Wien (2011-06-01)

  • Bug fix: Wrong output type detection in some circumstances

Version 2.1.5 by Thomas Wien (2011-05-24)

  • Dividing method ANN_Math::random() in ANN_Math::randomDelta() and ANN_Math::randomWeight()
  • Better implementation of printing network details including __invoke() und __toString() converting

Version 2.1.4 by Thomas Wien (2011-05-23)

  • Better calculation of remaining time of running the network
  • Fixing bug: generating random delta not correct
  • Adding momentum value
  • Simplified ANN_Neuron::adjustWeights()
  • Remove possible wrong calculation in ANN_Neuron::adjustWeights() on linear networks
  • Simplify ANN_Layer::calculateHiddenDeltas()

Version 2.1.3 by Thomas Wien (2010-01-06)

  • Date input support class

Version 2.1.2 by Thomas Wien (2009-12-26)

  • Classification support
  • Phar support (as of PHP 5.3.0)

Version 2.1.1 by Thomas Wien (2009-12-23)

  • String association support

Version 2.1.0 by Thomas Wien (2009-12-22)

  • Checking parameter counts on ANN_Values::input() and ANN_Values::output()
  • Removing protected method ANN_Neuron::getInputs()
  • Fixing bug: Error tolerance calculation in ANN_Network::isTrainingComplete()
  • Switching to Git version control
  • Moving all experimental code into branch
  • Removing all experimental code from master branch (due to performance and future development)

Version 2.0.7 by Thomas Wien (2009-01-01) Download

  • Removing protected method ANN_Neuron::setOutput()
  • Removing protected unused method ANN_Layer::getInputs()
  • Removing protected unused property ANN_Layer::$arrInputs
  • More detailed exceptions to ANN_Filesystem::saveToFile()
  • Different distribution of activation calls across the layers
  • Different adjustments in ANN_Neuron::adjustWeights() depending on output type
  • Removing static local variables from ANN_Network::getNextIndexInputsToTrain()
  • Increasing math precision
  • Using class constants for output types (increasing performance)
  • Fixing bug: ANN_Neuron::getOutput() is float and not array

Version 2.0.6 by Thomas Wien (2008-12-18)

  • Printing network details of output differences to their desired values
  • Complete rewritten code standard of variables
  • New class ANN_Values for defining input and output values
  • Code examples to phpdoc
  • Internal math precision defaults to 5

Version 2.0.5 by Thomas Wien (2008-12-16)

  • Adjustable output error tolerance between 0 and 10 per cent
  • Internal rounding of floats for performance issues
  • Loading class for all ANN classes (SPL autoload)
  • Renaming filename of ANN_Maths class
  • Improving code standard
  • Fixing bug: Comparison in ANN_InputValue and ANN_OutputValue

Version 2.0.4 by Thomas Wien (2008-01-27)

  • Weight decay
  • QuickProp algorithm (experimental)
  • RProp algorithm (experimental)
  • Linear saturated activation function (experimental)
  • Individual learning rate algorithm (experimental)
  • Reducing of overfitting (no training if input pattern produces desired output)
  • Increasing performance on activation
  • Increasing performance on testing all patterns to their desired outputs
  • Increasing performance on calculating hidden deltas
  • Increasing performance by defining layer relation by construction
  • More details to printNetwork()
  • Fixing bug: learning rate is not part of saved delta value

Version 2.0.3 by Thomas Wien (2008-01-17)

  • Support for dynamic learning rate
  • Automatic epoch determination
  • Automatic output type detection
  • Shuffling input patterns each epoch instead of randomized pattern access
  • Logging of network errors
  • Logging on each epoch instead of each training step
  • Avoiding distributed internal calls of setMomentum() and setLearningRate()
  • Extending display of network details
  • Fixing bug: runtime error on call of setMomentum()

Version 2.0.2 by Thomas Wien (2008-01-14)

  • Client-Server model for distributed applications
  • Calculating total network error for csv logging

Version 2.0.1 by Thomas Wien (2008-01-06)

  • Separation of classes to several files
  • Version control by Subversion
  • Performance issues
  • Graphical output of neural network topology
  • Logging of weights to csv file

Version 2.0.0 by Thomas Wien (2007-12-17)

  • PHP 5.x support
  • PHPDoc documentation
  • Momentum support
  • Avoiding network overfitting
  • Linear / binary output
  • ANN_InputValue + ANN_OutputValue classes
  • Exceptions
  • Threshold function
  • Hyperbolic tangent transfer function
  • Several performance issues
  • Avoiding array_keys() & srand() due to performance
  • Changes in saving and loading network
  • Printing network details to browser
  • Fixing bug: initializing inputs to all hidden layers
  • Fixing bug: training for first hidden layer was skipped

Version 1.0 by Eddy Young (2002)

  • Initial version


  • More Examples
  • Performance check depending on host system
  • Wiki: More details to installation and use
  • PHPDoc: More details to documentation
  • Improving license agreement of source code
  • Adding error codes to exceptions
  • Exception if network error does not reach minimum