Multilayer perceptron: Difference between revisions

From Artificial Neural Network for PHP
No edit summary
No edit summary
Line 2: Line 2:


A multilayer perceptron is a feedforward artificial neural network. This means the signal inside the neural network flows from input layer passing hidden layers to output layer. While training the error correction of neural weights are done in the opposite direction. This is done by the backpropagation algorithm.
A multilayer perceptron is a feedforward artificial neural network. This means the signal inside the neural network flows from input layer passing hidden layers to output layer. While training the error correction of neural weights are done in the opposite direction. This is done by the backpropagation algorithm.

== Activation ==

At first a cumulative input is calculated by the following equation:

<math>s = \sum^{n}_{k=1} i_{k} \cdot w_{k}</math>

=== Sigmoid activation function ===

<math>o = \rm{sig}(s) = \frac{1}{1 + \rm e^{-s}}</math>

=== Tangens hyperbolicus activation function ===

<math>o = tanh(s)</math>

using output range between -1 and 1, or

<math>o = \frac{tanh(s) + 1}{2}</math>

using output range between 0 and 1.

:<math>s</math> cumulative input
:<math>w</math> weight of input
:<math>i</math> value of input
:<math>n</math> number of inputs
:<math>k</math> number of neuron



== Error of neural network ==
== Error of neural network ==

Revision as of 13:46, 13 January 2008

General

A multilayer perceptron is a feedforward artificial neural network. This means the signal inside the neural network flows from input layer passing hidden layers to output layer. While training the error correction of neural weights are done in the opposite direction. This is done by the backpropagation algorithm.

Activation

At first a cumulative input is calculated by the following equation:

Sigmoid activation function

Tangens hyperbolicus activation function

using output range between -1 and 1, or

using output range between 0 and 1.

cumulative input
weight of input
value of input
number of inputs
number of neuron


Error of neural network

If the neural network is initialized by random weights it has of course not the expected output. Therefore training is necessary. While supervised training known inputs and their corresponded output values are presented to the network. So it is possible to compare the real output with the desired output. The error is described as the following algorithm:

network error
count of input patterns
desired output
calculated output

Backpropagation

The learning algorithm of a single layer perceptron is easy compared to a multilayer perceptron. The reason is that just the output layer is directly connected to the output, but not the hidden layers. Therefore the calculation of the right weights of the hidden layers is difficult mathematically. To get the right delta value for changing the weights of hidden neuron is described in the following equation:

delta value of neuron connection to
learning rate
the error of neuron
input of neuron
desired output of output neuron
real output of output neuron .

Programming solution of backpropagation

In this PHP implementation of multilayer perceptron the following algorithm is used for weight changes in hidden layers:

learning rate
momentum
neuron k
neuron l
weight m
input
output
count of neurons

To avoid overfitting of neural network the training procedure is finished if real output value has a fault tolerance of 1 per cent of desired output value.