fann_generic.h

The fann generic implementation is a backward compatible MIMO neuron implementation.  Using the MIMO Neuron defined by theese functions one gets a MIMO neuron that behaves like an old FANN Neuron i.e. it gets its working parameters from the struct fann.  This MIMO implementation is a kind of compatibilty layer to allow old FANN using applications to run unmodified.  This code is not fast: the new VFANN implementations will be much smarter (specilized) and faster.  The code in here uses swithches everywhere there is need to select something like activation functions and algorithms.

Summary
The fann generic implementation is a backward compatible MIMO neuron implementation.
destroy the layer allocated data
Allocates room inside the layer for neurons and connections.
Iterates over all neurons and calls the respective run functions.
Allocates room inside the layer for training data structures.
destroy the neuron allocated data
Allocates room inside the neuron for the connections.
Does a forward iteration on the neuron.
Allocates room inside the neuron for training data structures.
Compute the error on a MIMO Neuron after forward propagation of a certain input vector i.e.
Train the MIMO neuron: this function backpropagates the error to the previous layer and computes the weight update.
Apply the training on the MIMO neuron: the weight update stored in the neuron is applied.
This structure just stores the arrays needed to use all the algorims supported in old fann code.

Functions

MAKE_NAME(layer_destructor)

FANN_EXTERNAL void FANN_API MAKE_NAME(
   layer_destructor
)(struct fann_layer* layer)

destroy the layer allocated data

MAKE_NAME(layer_constructor)

FANN_EXTERNAL int FANN_API MAKE_NAME(
   layer_constructor
)(struct fann *ann, struct fann_layer *layer, struct fann_layer_descr *descr)

Allocates room inside the layer for neurons and connections.  Adds one bias output set to 1.

MAKE_NAME(layer_run)

FANN_EXTERNAL void FANN_API MAKE_NAME(
   layer_run
)(struct fann *ann, struct fann_layer* layer)

Iterates over all neurons and calls the respective run functions.  The implementation is responsible for setting up the input array.  If data is not already there this function must copy it into the inpuit array before calling neuron_it->run().

MAKE_NAME(layer_train_initialize)

FANN_EXTERNAL void FANN_API MAKE_NAME(
   layer_train_initialize
)(struct fann *ann, struct fann_layer *layer)

Allocates room inside the layer for training data structures.  This function is called just when it is necessary to allocate the space for training.  If a network is not going to be trainied (when using an already trainied network) all this stuff is not allocated.

MAKE_NAME(neuron_destructor)

FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_destructor
)(struct fann_neuron* neuron)

destroy the neuron allocated data

MAKE_NAME(neuron_constructor)

FANN_EXTERNAL int FANN_API MAKE_NAME(
   neuron_constructor
)(struct fann *ann, struct fann_layer *layer, struct fann_neuron *neuron, struct fann_neuron_descr * descr)

Allocates room inside the neuron for the connections.  Creates a fully connected neuron.

MAKE_NAME(neuron_run)

FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_run
)(struct fann *ann, struct fann_neuron *neuron)

Does a forward iteration on the neuron.

MAKE_NAME(neuron_train_initialize)

FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_train_initialize
)(struct fann *ann, struct fann_layer *layer, struct fann_neuron *neuron)

Allocates room inside the neuron for training data structures.  This function is called just when it is necessary to allocate the space for training.  If a network is not going to be trainied (when using an already trainied network) all this stuff is not allocated.

MAKE_NAME(neuron_compute_MSE)

FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_compute_MSE
)(struct fann *ann, struct fann_neuron *neuron, fann_type *desired_output)

Compute the error on a MIMO Neuron after forward propagation of a certain input vector i.e. after neuron->run().  The error is the sum, over all the outputs, of the squared difference between the computed output and the desired target also increments a counter because MSE is an average of such errors

After calling this function on a neuron the train_errors array is set to

(desired_outputneuron_value)

MAKE_NAME(neuron_backprop)

FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_backprop
)(struct fann *ann, struct fann_neuron *neuron, fann_type *prev_layer_errors)

Train the MIMO neuron: this function backpropagates the error to the previous layer and computes the weight update.  The weight update is not applied here see <MAKE_NAME(neuron_update>)

MAKE_NAME(neuron_update)

FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_update
)(struct fann *ann, struct fann_neuron *neuron)

Apply the training on the MIMO neuron: the weight update stored in the neuron is applied.  This function is called once per input pattern when online training is carried on and once per epoch when batch algoritms are selected

MAKE_NAME(neuron_private_data)

This structure just stores the arrays needed to use all the algorims supported in old fann code.

FANN_EXTERNAL void FANN_API MAKE_NAME(
   layer_destructor
)(struct fann_layer* layer)
destroy the layer allocated data
FANN_EXTERNAL int FANN_API MAKE_NAME(
   layer_constructor
)(struct fann *ann, struct fann_layer *layer, struct fann_layer_descr *descr)
Allocates room inside the layer for neurons and connections.
FANN_EXTERNAL void FANN_API MAKE_NAME(
   layer_run
)(struct fann *ann, struct fann_layer* layer)
Iterates over all neurons and calls the respective run functions.
FANN_EXTERNAL void FANN_API MAKE_NAME(
   layer_train_initialize
)(struct fann *ann, struct fann_layer *layer)
Allocates room inside the layer for training data structures.
FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_destructor
)(struct fann_neuron* neuron)
destroy the neuron allocated data
FANN_EXTERNAL int FANN_API MAKE_NAME(
   neuron_constructor
)(struct fann *ann, struct fann_layer *layer, struct fann_neuron *neuron, struct fann_neuron_descr * descr)
Allocates room inside the neuron for the connections.
FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_run
)(struct fann *ann, struct fann_neuron *neuron)
Does a forward iteration on the neuron.
FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_train_initialize
)(struct fann *ann, struct fann_layer *layer, struct fann_neuron *neuron)
Allocates room inside the neuron for training data structures.
FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_compute_MSE
)(struct fann *ann, struct fann_neuron *neuron, fann_type *desired_output)
Compute the error on a MIMO Neuron after forward propagation of a certain input vector i.e.
FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_backprop
)(struct fann *ann, struct fann_neuron *neuron, fann_type *prev_layer_errors)
Train the MIMO neuron: this function backpropagates the error to the previous layer and computes the weight update.
FANN_EXTERNAL void FANN_API MAKE_NAME(
   neuron_update
)(struct fann *ann, struct fann_neuron *neuron)
Apply the training on the MIMO neuron: the weight update stored in the neuron is applied.