class FFLayer

Represents one (fully-connected) layer from a multi-layer percetron (FFNet) More...

Definition#include <NNet/include/FFLayer.h>
InheritsObject (data-flow)
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Members


Detailed Description

Represents one (fully-connected) layer from a multi-layer percetron (FFNet)

 void (*func) (float *, float *, int)

Activation function pointer

 void (*deriv_func) (float *, float *, int)

Activation function derivative pointer

int nbNeurons

[protected]

Number of neurons in the layer

int nbInputs

[protected]

Number of input neurons

float * weights

[protected]

Pointer to the weight vector

string funcType

[protected]

int weightOffset

[protected]

Offset of the layer weight vector in the network weight vector

int neuronOffset

[protected]

Offset of the layer's first neuron in the list of all network neurons (not too sure about that one, though)

float derivOffset

[protected]

Offset of the layer's first neuron derivative in the list of all network neurons

 FFLayer () : derivOffset(0)

This (empty) constructor is used for parsing a layer from a file

 FFLayer (int _nbNeurons, int _nbInputs, float *_weights, int _weightOffset, int _neuronOffset, string type = "tansig")

Standard constructor

 FFLayer (const FFLayer &layer)

Unimplemented yet (not sure if we *should* implement it)

void  setupAfterRead (float *_weights, int _weightOffset, int _neuronOffset)

Called after reading a layer to setup the weight vector correctly

FFLayer ()

void  update (const float *previous, float *value, float *deriv=NULL)

Calculates all the activation functions (and derivatives) for a given input

int  size ()

Layer size

int  getNbWeights ()

Number of weights

int  getNeuronWeightOffset (int i)

Offset of a certain neuron's weight vector relative to the whole network's weight vector

int  getWeightOffset ()

int  getNeuronOffset ()

void  init (float minmax)

void  init (double *mean, double *std)

Initializes the layer values given the means and standard deviations of each of the inputs

void  setBias (double *minmax)

Sets the bias vector

float * getWeights (int i)

void  printOn (ostream &out)

[const]

Writes the layer to a stream

Reimplemented from Object.

void  readFrom (istream &in)

Reads the layer from a stream (remember to call setupAfterRead after that

Reimplemented from Object.

void  setDerivOffset (float d)