Class OverviewMulti-layer Neural Network in PHP Author(s):Version:
|
Methods |
Loosely based on source code by Phil Brierley, that was translated into PHP by 'dspink' in sep 2005
Algorithm was obtained from the excellent introductory book "Artificial Intelligence - a guide to intelligent systems" by Michael Negnevitsky (ISBN 0-201-71159-1)
Example: learning the 'XOR'-function
The resulting output could for example be something along the following lines:
...which indicates the network has learned the task.
version: | 1.0 |
since: | feb 2007 |
author: | E. Akerboom |
author: | Tremani, Delft |
license: | BSD License |
|
Example:
array | $nodecount | The number of nodes in the consecutive layers. |
|
return: | The final output of the node |
float | $value | The preliminary output to apply this function to |
|
This set of data is used to prevent 'overlearning' of the network. The network will stop training if the results obtained for the control data are worsening.
The data added as control data is not used for training.
array | $input | An input vector |
array | $output | The corresponding output |
int | $id | (optional) An identifier for this piece of data |
|
array | $input | An input vector |
array | $output | The corresponding output |
int | $id | (optional) An identifier for this piece of data |
|
return: | The output of the network |
array | $input | The vector to calculate |
|
float | $value | 'X' |
|
return: | An array of identifiers |
|
return: | The learning rate for that layer |
int | $layer | The layer to obtain the learning rate for |
|
return: | A random weight |
$layer |
|
return: | An array of identifiers |
|
return: | 'true' if status and error messages are displayed, 'false' otherwise |
|
return: | 'true' on success, 'false' otherwise |
string | $filename | The filename to load the network from |
|
return: | 'true' on success, 'false' otherwise |
string | $filename | The filename to save the neural network to |
|
array | $learningrate | An array containing the learning rates [range 0.0 - 1.0]. The size of this array is 'layercount - 1'. You might also provide a single number. If that is the case, then this will be the learning rate for the whole network. |
|
float | $momentum | The momentum. Must be between 0.0 and 1.0; Usually between 0.5 and 0.9 |
|
boolean | $is_verbose | 'true' if you want to display status and error messages, 'false' if you don't |
|
boolean | $force | Force the output, even if the network is not verbose. |
|
return: | 'true' if the training was successful, 'false' otherwise |
int | $maxEpochs | The maximum number of epochs |
float | $maxError | The maximum squared error in the training data |