TanhNet Class Reference

Offers a predefined feed-forward neural network, which uses the "tanh" activation function for hidden and output neurons. More...

#include <TanhNet.h>

Inheritance diagram for TanhNet:
FFNet Model

List of all members.

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 $g_{hidden}(x)$ of the hidden neurons.
double dg (double ga)
 Computes the derivative of the activation function $g_{hidden}(x)$ for the hidden neurons.
double gOutput (double a)
 Activation function $g_{output}(x)$ of the output neurons.
double dgOutput (double ga)
 Computes the derivative of the activation function $g_{output}(x)$ for the output neurons.

Detailed Description

Offers a predefined feed-forward neural network, which uses the "tanh" activation function for hidden and output neurons.

The $tanh$ (tangens hyperbolicus) function replaces the default logistic function as defined in ModelInterface. The $tanh$ function differs from the logistic function only through a linear transformation, but empirically, it is often found that $tanh$ activation functions give rise to faster convergence of training algorithms than logistic functions.

Author:
C. Igel, M. Hüsken
Date:
1999
Changes:
none
Status:
stable

Definition at line 76 of file TanhNet.h.


Constructor & Destructor Documentation

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.

Parameters:
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.
Returns:
None.
Example

1 1

0 0 0 0
1 0 0 1
0 1 0 1

0 0 0 0
3 0 0 2
0 3 0 2

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".

Author:
C. Igel
Date:
1999
Changes
none
Status
stable

Definition at line 132 of file TanhNet.h.


Member Function Documentation

double TanhNet::dg ( double  ga  )  [inline, virtual]

Computes the derivative of the activation function $g_{hidden}(x)$ for the hidden neurons.

The derivative function $g^*_{\mbox{hidden}}$ is defined as

$ g^*_{hidden}(g_{hidden}(x)) = \frac{\partial g_{hidden}(x)}{\partial x} $

Parameters:
ga The value of $g_{hidden}(x)$.
Returns:
The result of $g^*_{hidden}(g_{hidden}(x))$
Author:
C. Igel, M. Hüsken
Date:
1999
Changes
none
Status
stable
See also:
g

Reimplemented from FFNet.

Definition at line 209 of file TanhNet.h.

double TanhNet::dgOutput ( double  ga  )  [inline, virtual]

Computes the derivative of the activation function $g_{output}(x)$ for the output neurons.

The derivative function $g^*_{\mbox{output}}$ is defined as

$ g^*_{output}(g_{output}(x)) = \frac{\partial g_{output}(x)}{\partial x} $

Parameters:
ga The value of $g_{output}(x)$.
Returns:
The result of $g^*_{output}(g_{output}(x))$
Author:
C. Igel, M. Hüsken
Date:
1999
Changes
none
Status
stable
See also:
gOutput, dg

Reimplemented from FFNet.

Definition at line 291 of file TanhNet.h.

double TanhNet::g ( double  a  )  [inline, virtual]

Activation function $g_{hidden}(x)$ of the hidden neurons.

The activation function is used for the propagation of the input through the network. Given a network with $M$ neurons, including $c$ input neurons and $n$ output neurons, the sigmoid activation function for the hidden neuron with index $i \mbox{,\ } c \leq i < M - n$ is given as

$ z_i = g_{hidden}(x) = tanh(a) = \frac{2}{(1 + e^{-2a}) - 1} $

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

$ a = \left( \sum_{j=0}^{j<i} w_{ij} z_j + \Theta_i \right) $

and $ \Theta_i $ denotes the bias term.
The $tanh$ function maps input values to $-1, \dots, 1$.

Parameters:
a Input for the activation function, see above.
Returns:
$ z_i $.
Author:
C. Igel, M. Hüsken
Date:
1999
Changes
none
Status
stable
See also:
gOutput

Reimplemented from FFNet.

Definition at line 176 of file TanhNet.h.

double TanhNet::gOutput ( double  a  )  [inline, virtual]

Activation function $g_{output}(x)$ of the output neurons.

The activation function is used for the propagation of the input through the network. Given a network with $M$ neurons, including $c$ input neurons and $n$ output neurons, the sigmoid activation function for the output neuron with index $i \mbox{,\ } M - n \leq i < M $ is given as

$ z_i = g_{output}(x) = tanh(a) = \frac{2}{(1 + e^{-2a}) - 1} $

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

$ a = \left( \sum_{j=0}^{j<i} w_{ij} z_j + \Theta_i \right) $

and $ \Theta_i $ denotes the bias term.
The $tanh$ function maps input values to $-1, \dots, 1$.

Parameters:
a Input for the activation function, see above.
Returns:
$ z_i $.
Author:
C. Igel, M. Hüsken
Date:
1999
Changes
none
Status
stable
See also:
g

Reimplemented from FFNet.

Definition at line 256 of file TanhNet.h.


The documentation for this class was generated from the following file: