libneuron 0.0.13

C++LibraryforNeuralNetworks

Neural Network with Hidden Layers

From Wikipedia: «A neuron is an electrically excitable cell that processes and transmits information through electrical and chemical signals. These signals between neurons occur via synapses, specialized connections with other cells. Neurons can connect to each other to form neural networks. Neurons are the core components of the brain and spinal cord of the central nervous system, and of the ganglia of the peripheral nervous system.» The neuron connects with dendrites to the world or to the axon of other neuirons. The neurites (dendrite or axon) transport electrical stimulation to the cell, which emits the signal to the dendrites if the activation reaches a certain level.

A complex neural network can be imitiated as a vector `I`

of `i`

input values, a vector `O`

of `o`

output values and any number `l`

of hidden layers, where each of them contains `h`

neurons.

A neural network with double precision is initialized as:

The connections between two layers can be modelled as a Matrix. Then Matrix H_{1} contains the weights from `I`

to the first hidden layer, `H`

from the first to the second, and so on, until _{2}`H`

contains the weights from layer _{l+1}`l`

to the output `O`

.

There is also an activation function . For back propagation, this function needs a first derivation `f'`

.

To get the activation of the first hidden layer, the input vector is multiplied with the weight matrix of the first hidden layer, this results in an output vector. Then the activation function is applied to all values of the output vector:

V_{1}= f(I×H_{1})

This is done for all layers, up to the output. The output vector is then calculated as:

O = f(f(f(f(I×H_{1})×H_{2})×H_{…})×H_{l+1})

const size_type i(4);

const size_type o(2);

Matrix<1, i> input(1.0, 2.0, 0.0, -1.0);

Matrix<1, o> output = feed(input);