libneuron 0.0.13
Neural Network with Hidden Layers


Natural Neural Network

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.

Artificial Neural Network

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:

Forward Propagation

The connections between two layers can be modelled as a Matrix. Then Matrix H1 contains the weights from I to the first hidden layer, H2 from the first to the second, and so on, until Hl+1 contains the weights from layer 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:

V1 = f(I×H1)

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

O = f(f(f(f(I×H1)×H2)×H)×Hl+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);

Back Propagation