#include <multilayerffnn.h>
Inherits FeedForwardNN.
Inherited by Elman.
Inheritance diagram for MultiLayerFFNN:
Public Member Functions | |
MultiLayerFFNN (double eps, const std::vector< Layer > &layers, bool useBypass=false, bool someInternalParams=true) | |
virtual | ~MultiLayerFFNN () |
virtual void | init (unsigned int inputDim, unsigned int outputDim, double unit_map=0.0, RandGen *randGen=0) |
initialisation of the network with the given number of input and output units. | |
virtual const matrix::Matrix | process (const matrix::Matrix &input) |
passive processing of the input | |
virtual const matrix::Matrix | learn (const matrix::Matrix &input, const matrix::Matrix &nom_output, double learnRateFactor=1) |
performs learning and returns the network output before learning (process should be called before) | |
virtual const matrix::Matrix | response (const matrix::Matrix &input) const |
response matrix of neural network at given input | |
virtual const matrix::Matrix | inversion (const matrix::Matrix &input, const matrix::Matrix &xsi) const |
calculates the input shift v to a given output shift xsi via pseudo inversion. | |
virtual unsigned int | getInputDim () const |
returns the number of input neurons | |
virtual unsigned int | getOutputDim () const |
returns the number of output neurons | |
virtual matrix::Matrix | getLayerOutput (unsigned int layer) |
returns activation of the given layer. Layer 0 is the first hidden layer | |
virtual void | damp (double damping) |
damps the weights and the biases by multiplying (1-damping) | |
virtual unsigned int | getLayerNum () const |
virtual const Layer & | getLayer (unsigned int layer) const |
layers 0 is the first hidden layer | |
virtual Layer & | getLayer (unsigned int layer) |
layers 0 is the first hidden layer | |
virtual const matrix::Matrix & | getWeights (unsigned int to_layer) const |
weight matrix 0 connects input with the first hidden layer | |
virtual matrix::Matrix & | getWeights (unsigned int to_layer) |
weight matrix 0 connects input with the first hidden layer | |
virtual const matrix::Matrix & | getBias (unsigned int of_layer) const |
layers 0 is the first hidden layer | |
bool | store (FILE *f) const |
stores the layer binary into file stream | |
bool | restore (FILE *f) |
restores the layer binary from file stream | |
bool | write (FILE *f) const |
writes the layer ASCII into file stream (not in the storable interface) | |
virtual iparamkeylist | getInternalParamNames () const |
The list of the names of all internal parameters given by getInternalParams(). | |
virtual iparamvallist | getInternalParams () const |
virtual ilayerlist | getStructuralLayers () const |
Specifies which parameter vector forms a structural layer (in terms of a neural network) The ordering is important. | |
virtual iconnectionlist | getStructuralConnections () const |
Specifies which parameter matrix forms a connection between layers (in terms of a neural network) The orderning is not important. | |
virtual void | setSomeInternalParams (bool someInternalParams) |
virtual std::vector< ActivationFunction > | setActivationFunction (ActivationFunction actfun) |
sets the activation function (and derivative and inversion too) for ALL layers! | |
virtual void | setActivationFunctions (std::vector< ActivationFunction > actfunList) |
sets the activation functions (and derivative and inversion too) for all layers. | |
Public Attributes | |
double | eps |
learning rate | |
Protected Attributes | |
std::vector< Layer > | layers |
std::vector< matrix::Matrix > | weights |
std::vector< matrix::Matrix > | bias |
std::vector< matrix::Matrix > | smallids |
bool | useBypass |
matrix::Matrix | bypassWeights |
bool | someInternalParams |
matrix::Matrix | input |
std::vector< matrix::Matrix > | ys |
std::vector< matrix::Matrix > | zs |
bool | initialised |
MultiLayerFFNN | ( | double | eps, | |
const std::vector< Layer > & | layers, | |||
bool | useBypass = false , |
|||
bool | someInternalParams = true | |||
) |
eps | learning rate | |
layers | Layer description (the input layer is not specified (always linear)) | |
useBypass | if true, then a connection from input to output layer is included | |
someInternalParams | if true then only a few parameters are send to plotting |
virtual ~MultiLayerFFNN | ( | ) | [inline, virtual] |
void damp | ( | double | damping | ) | [virtual] |
damps the weights and the biases by multiplying (1-damping)
Implements FeedForwardNN.
Reimplemented in Elman.
virtual const matrix::Matrix& getBias | ( | unsigned int | of_layer | ) | const [inline, virtual] |
layers 0 is the first hidden layer
virtual unsigned int getInputDim | ( | ) | const [inline, virtual] |
Inspectable::iparamkeylist getInternalParamNames | ( | ) | const [virtual] |
The list of the names of all internal parameters given by getInternalParams().
The naming convention is "v[i]" for vectors and "A[i][j]" for matrices, where i, j start at 0.
Reimplemented from Inspectable.
Reimplemented in Elman.
Inspectable::iparamvallist getInternalParams | ( | ) | const [virtual] |
virtual Layer& getLayer | ( | unsigned int | layer | ) | [inline, virtual] |
layers 0 is the first hidden layer
virtual const Layer& getLayer | ( | unsigned int | layer | ) | const [inline, virtual] |
layers 0 is the first hidden layer
virtual unsigned int getLayerNum | ( | ) | const [inline, virtual] |
virtual matrix::Matrix getLayerOutput | ( | unsigned int | layer | ) | [inline, virtual] |
returns activation of the given layer. Layer 0 is the first hidden layer
virtual unsigned int getOutputDim | ( | ) | const [inline, virtual] |
Inspectable::iconnectionlist getStructuralConnections | ( | ) | const [virtual] |
Specifies which parameter matrix forms a connection between layers (in terms of a neural network) The orderning is not important.
Reimplemented from Inspectable.
Reimplemented in Elman.
Inspectable::ilayerlist getStructuralLayers | ( | ) | const [virtual] |
Specifies which parameter vector forms a structural layer (in terms of a neural network) The ordering is important.
The first entry is the input layer and so on.
Reimplemented from Inspectable.
Reimplemented in Elman.
virtual matrix::Matrix& getWeights | ( | unsigned int | to_layer | ) | [inline, virtual] |
weight matrix 0 connects input with the first hidden layer
virtual const matrix::Matrix& getWeights | ( | unsigned int | to_layer | ) | const [inline, virtual] |
weight matrix 0 connects input with the first hidden layer
void init | ( | unsigned int | inputDim, | |
unsigned int | outputDim, | |||
double | unit_map = 0.0 , |
|||
RandGen * | randGen = 0 | |||
) | [virtual] |
initialisation of the network with the given number of input and output units.
The dimensionality of the ouputlayer is automatically adjusted.
unit_map | defines the approximate response of the network after initialisation (if unit_map=1 the weights are unit matrices). | |
randGen | pointer to random generator, if 0 an new one is used |
Implements AbstractModel.
Reimplemented in Elman.
const Matrix inversion | ( | const matrix::Matrix & | input, | |
const matrix::Matrix & | xsi | |||
) | const [virtual] |
calculates the input shift v to a given output shift xsi via pseudo inversion.
The result is a vector of dimension inputdim. ATTENTION: input is ignored! use process before!
Implements InvertableModel.
const Matrix learn | ( | const matrix::Matrix & | input, | |
const matrix::Matrix & | nom_output, | |||
double | learnRateFactor = 1 | |||
) | [virtual] |
performs learning and returns the network output before learning (process should be called before)
Implements AbstractModel.
Reimplemented in Elman.
const Matrix process | ( | const matrix::Matrix & | input | ) | [virtual] |
const Matrix response | ( | const matrix::Matrix & | input | ) | const [virtual] |
response matrix of neural network at given input
with is the weight matrix of layer n and
is a diagonal matrix with
as values on the diagonal. ATTENTION: input is ignored! use process before!
Implements InvertableModel.
bool restore | ( | FILE * | f | ) | [virtual] |
std::vector< ActivationFunction > setActivationFunction | ( | ActivationFunction | actfun | ) | [virtual] |
sets the activation function (and derivative and inversion too) for ALL layers!
actfun | the activation function to be used |
void setActivationFunctions | ( | std::vector< ActivationFunction > | actfunList | ) | [virtual] |
sets the activation functions (and derivative and inversion too) for all layers.
actfunList | the list of actfuns to be used |
virtual void setSomeInternalParams | ( | bool | someInternalParams | ) | [inline, virtual] |
bool store | ( | FILE * | f | ) | const [virtual] |
bool write | ( | FILE * | f | ) | const |
writes the layer ASCII into file stream (not in the storable interface)
std::vector<matrix::Matrix> bias [protected] |
matrix::Matrix bypassWeights [protected] |
double eps |
learning rate
bool initialised [protected] |
matrix::Matrix input [protected] |
std::vector<matrix::Matrix> smallids [protected] |
bool someInternalParams [protected] |
bool useBypass [protected] |
std::vector<matrix::Matrix> weights [protected] |
std::vector<matrix::Matrix> ys [protected] |
std::vector<matrix::Matrix> zs [protected] |