Offers a predefined feed-forward neural network, which uses the "tanh" activation function for hidden and output neurons. More...
#include <TanhNet.h>
Public Member Functions | |
| TanhNet (const std::string &filename) | |
| Creates a tanh feed-forward network by reading the necessary information from a file named "filename". | |
| double | g (double a) |
Activation function of the hidden neurons. | |
| double | dg (double ga) |
Computes the derivative of the activation function for the hidden neurons. | |
| double | gOutput (double a) |
Activation function of the output neurons. | |
| double | dgOutput (double ga) |
Computes the derivative of the activation function for the output neurons. | |
Offers a predefined feed-forward neural network, which uses the "tanh" activation function for hidden and output neurons.
The
(tangens hyperbolicus) function replaces the default logistic function as defined in ModelInterface. The
function differs from the logistic function only through a linear transformation, but empirically, it is often found that
activation functions give rise to faster convergence of training algorithms than logistic functions.
Definition at line 76 of file TanhNet.h.
| TanhNet::TanhNet | ( | const std::string & | filename | ) | [inline] |
Creates a tanh feed-forward network by reading the necessary information from a file named "filename".
A file is used to create a new network. This file must have the following content: The first line of the file must contain two numbers that specify the number of input and the number of output neurons of the network, respectively.
This line is followed by the values for the connectionMatrix.
The third and last part are the values for the weightMatrix.
| filename | Name of the file that contains the information for the creation of the network. If the file doesn't exist, the method will exit with failure. |
A file with the content shown above will create a network with 1 input and 1 output neuron.
A connection exists from the input neuron to the single hidden neuron of the network and from the hidden neuron to the output neuron. Each of the two connections has a weight of "3".
The connection of each neuron (except the input neuron) to the bias value has a weight of "2".
| double TanhNet::dg | ( | double | ga | ) | [inline, virtual] |
| double TanhNet::dgOutput | ( | double | ga | ) | [inline, virtual] |
| double TanhNet::g | ( | double | a | ) | [inline, virtual] |
Activation function
of the hidden neurons.
The activation function is used for the propagation of the input through the network. Given a network with
neurons, including
input neurons and
output neurons, the sigmoid activation function for the hidden neuron with index
is given as

where
as the propagated result of the input for the previous neurons is calculated as

and
denotes the bias term.
The
function maps input values to
.
| a | Input for the activation function, see above. |
.Reimplemented from FFNet.
| double TanhNet::gOutput | ( | double | a | ) | [inline, virtual] |
Activation function
of the output neurons.
The activation function is used for the propagation of the input through the network. Given a network with
neurons, including
input neurons and
output neurons, the sigmoid activation function for the output neuron with index
is given as

where
as the propagated result of the input for the previous neurons is calculated as

and
denotes the bias term.
The
function maps input values to
.
| a | Input for the activation function, see above. |
.Reimplemented from FFNet.