mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2025-02-10 07:58:57 +00:00
c1b1a5d6ac
* Multiple training data sets allowed * Tests with multiple training data sets * Updating docs according to #38 Documenting all models which predictions will be based on all training data provided. Some models already supported multiple training data sets.
31 lines
898 B
Markdown
31 lines
898 B
Markdown
# Backpropagation
|
|
|
|
Backpropagation, an abbreviation for "backward propagation of errors", is a common method of training artificial neural networks used in conjunction with an optimization method such as gradient descent.
|
|
|
|
## Constructor Parameters
|
|
|
|
* $network (Network) - network to train (for example MultilayerPerceptron instance)
|
|
* $theta (int) - network theta parameter
|
|
|
|
```
|
|
use Phpml\NeuralNetwork\Network\MultilayerPerceptron;
|
|
use Phpml\NeuralNetwork\Training\Backpropagation;
|
|
|
|
$network = new MultilayerPerceptron([2, 2, 1]);
|
|
$training = new Backpropagation($network);
|
|
```
|
|
|
|
## Training
|
|
|
|
Example of XOR training:
|
|
|
|
```
|
|
$training->train(
|
|
$samples = [[1, 0], [0, 1], [1, 1], [0, 0]],
|
|
$targets = [[1], [1], [0], [0]],
|
|
$desiredError = 0.2,
|
|
$maxIteraions = 30000
|
|
);
|
|
```
|
|
You can train the neural network using multiple data sets, predictions will be based on all the training data.
|