24 #ifndef __CONTROLLERNET_H
25 #define __CONTROLLERNET_H
51 virtual void init(
unsigned int inputDim,
unsigned int outputDim,
52 double unit_map = 0.0,
double rand = 0.2,
RandGen* randGen = 0);
67 unsigned int injectInLayer);
70 virtual void damp(
double damping);
116 int startWithLayer = -1)
const;
162 return (
weights.rbegin())->getM();
169 if(layer<0) layer = layers.
size() + layer;
170 assert(layer>=0 && layer < (
int)layers.size());
176 return layers.size();
181 assert(layer < layers.size());
182 return layers[layer];
187 assert(layer < layers.size());
188 return layers[layer];
195 if(to_layer<0) to_layer =
weights.size() - to_layer;
196 assert(to_layer>=0 && to_layer < (
int)
weights.size());
204 if(to_layer<0) to_layer =
weights.size() - to_layer;
205 assert(to_layer>=0 && to_layer < (
int)
weights.size());
223 if(of_layer<0) of_layer =
bias.size() - of_layer;
224 assert(of_layer>=0 && of_layer < (
int)
bias.size());
225 return bias[of_layer];
232 if(of_layer<0) of_layer =
bias.size() - of_layer;
233 assert(of_layer>=0 && of_layer < (
int)
bias.size());
234 return bias[of_layer];
239 bool store(FILE* f)
const;
244 bool write(FILE* f)
const;
254 std::vector<matrix::Matrix>
bias;
Matrix type.
Definition: matrix.h:65
virtual const matrix::Matrix backpropagation(const matrix::Matrix &error, matrix::Matrices *errors=0, matrix::Matrices *zetas=0) const
backpropagation of vector error through network.
Definition: controllernet.cpp:237
virtual const matrix::Matrix backprojection(const matrix::Matrix &error, matrix::Matrices *errors=0, matrix::Matrices *zetas=0) const
backprojection of vector error through network.
Definition: controllernet.cpp:330
virtual unsigned int getInputDim() const
returns the number of input neurons
Definition: controllernet.h:157
virtual matrix::Matrix responsePart(int from, int to) const
like response, just that only a range of layers is considered The Bypass is not considered here...
Definition: controllernet.cpp:405
matrix::Matrices z
Definition: controllernet.h:262
I size() const
Definition: matrix.h:92
bool useBypass
Definition: controllernet.h:255
bool restore(FILE *f)
restores the layer binary from file stream
Definition: controllernet.cpp:473
bool initialised
Definition: controllernet.h:269
virtual void init(unsigned int inputDim, unsigned int outputDim, double unit_map=0.0, double rand=0.2, RandGen *randGen=0)
initialisation of the network with the given number of input and output units.
Definition: controllernet.cpp:42
virtual const matrix::Matrix & getLayerOutput(int layer) const
returns activation of the given layer.
Definition: controllernet.h:168
virtual const matrix::Matrix & getByPass() const
Definition: controllernet.h:209
matrix::Matrix L
Definition: controllernet.h:265
virtual unsigned int getOutputDim() const
returns the number of output neurons
Definition: controllernet.h:161
random generator with 48bit integer arithmentic
Definition: randomgenerator.h:34
virtual const matrix::Matrix forwardpropagation(const matrix::Matrix &error, matrix::Matrices *errors=0, matrix::Matrices *zetas=0) const
forwardpropagation of vector error through network.
Definition: controllernet.cpp:139
std::vector< matrix::Matrix > bias
Definition: controllernet.h:254
virtual const matrix::Matrix & response() const
response matrix of neural network (for current activation, see process) with is the weight matrix ...
Definition: controllernet.cpp:374
virtual const matrix::Matrix backpropagationX(const matrix::Matrix &error, matrix::Matrices *errors=0, matrix::Matrices *zetas=0, int startWithLayer=-1) const
like backpropagation but with special features: we can start from any layer and the bypass-discountin...
Definition: controllernet.cpp:266
bool write(FILE *f) const
writes the layer ASCII into file stream (not in the storable interface)
Definition: controllernet.cpp:454
virtual const matrix::Matrix & getBias(int of_layer) const
Note: layers 0 is the first hidden layer Negative values count from the end (-1 is the last layer) ...
Definition: controllernet.h:222
matrix::Matrix input
Definition: controllernet.h:260
virtual Layer & getLayer(unsigned int layer)
layers 0 is the first hidden layer
Definition: controllernet.h:186
virtual void calcResponseIntern()
Definition: controllernet.cpp:384
matrix::Matrices gp
Definition: controllernet.h:263
virtual unsigned int getLayerNum() const
Definition: controllernet.h:175
ControllerNet(const std::vector< Layer > &layers, bool useBypass=false)
Definition: controllernet.cpp:33
double lambda
Definition: controllernet.h:268
virtual ~ControllerNet()
Definition: controllernet.h:43
matrix::Matrix R
Definition: controllernet.h:266
virtual const matrix::Matrix & getWeights(int to_layer) const
weight matrix 0 connects input with the first hidden layer Negative values count from the end (-1 is ...
Definition: controllernet.h:194
virtual const matrix::Matrix process(const matrix::Matrix &input)
passive processing of the input.
Definition: controllernet.cpp:85
virtual matrix::Matrix & getWeights(int to_layer)
weight matrix 0 connects input with the first hidden layer Negative values count from the end (-1 is ...
Definition: controllernet.h:203
virtual matrix::Matrix & getBias(int of_layer)
Note: layers 0 is the first hidden layer Negative values count from the end (-1 is the last layer) ...
Definition: controllernet.h:231
Abstact class for configurable objects.
Definition: configurable.h:81
virtual void damp(double damping)
damps the weights and the biases by multiplying (1-damping)
Definition: controllernet.cpp:423
matrix::Matrix bypassWeights
Definition: controllernet.h:256
std::vector< Matrix > Matrices
Definition: matrix.h:40
virtual matrix::Matrix & getByPass()
Definition: controllernet.h:214
virtual const matrix::Matrix & responseLinear() const
linear response matrix of neural network with is the weight matrix of layer n.
Definition: controllernet.cpp:379
std::vector< Layer > layers
Definition: controllernet.h:252
std::vector< matrix::Matrix > weights
Definition: controllernet.h:253
bool store(FILE *f) const
stores the layer binary into file stream
Definition: controllernet.cpp:436
matrix::Matrices y
Definition: controllernet.h:261
multi layer neural network with configurable activation functions and propagation and projection meth...
Definition: controllernet.h:35
virtual const matrix::Matrix forwardprojection(const matrix::Matrix &error, matrix::Matrices *errors=0, matrix::Matrices *zetas=0) const
forwardprojection of vector error through network.
Definition: controllernet.cpp:197
virtual const matrix::Matrix processX(const matrix::Matrix &input, const matrix::Matrix &injection, unsigned int injectInLayer)
like process just with the opportunity to overwrite the activation of a specific layer ...
Definition: controllernet.cpp:108
virtual const Layer & getLayer(unsigned int layer) const
layers 0 is the first hidden layer
Definition: controllernet.h:180