Robotsystem from Robot Group Leipzig: feedforwardnn.h Source File

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# feedforwardnn.h

Go to the documentation of this file.

    00001 #ifndef __FEEDFORWARDNN_H
    00002 #define __FEEDFORWARDNN_H
    00003
    00004 #include <matrix.h>
    00005 #include "configurable.h"
    00006 #include <math.h>
    00007
    00008 typedef double (*ActivationFunction) (double);
    00009
    00010 /// abstract class (interface) for feed forward rate based neural networks
    00011 class FeedForwardNN : public Configurable {
    00012  public:
    00013   FeedForwardNN(){};
    00014   virtual ~FeedForwardNN(){};
    00015
    00016   /// initialisation of the network with the given number of input and output units
    00017   virtual void init(unsigned int inputDim, unsigned  int outputDim) = 0;
    00018   /// passive processing of the input
    00019   virtual const matrix::Matrix process (const matrix::Matrix& input) const = 0;
    00020   /* performs learning and returns the network output before learning
    00021      learnRateFactor can be given to modify eps for this learning step
    00022   */
    00023   virtual const matrix::Matrix learn (const matrix::Matrix& input,
    00024                                       const matrix::Matrix& nom_output,
    00025                                       double learnRateFactor = 1) = 0;
    00026
    00027   /// damps the weights and the biases by multiplying (1-damping)
    00028   virtual void damp(double damping) =0 ;
    00029
    00030   /// returns the number of input neurons
    00031   virtual unsigned int getInputDim() const = 0;
    00032   /// returns the number of output neurons
    00033   virtual unsigned int getOutputDim() const = 0;
    00034
    00035   static double linear(double x)   { return x;}
    00036   static double dlinear(double )   { return 1;}
    00037   static double tanh(double x)     { return ::tanh(x); }
    00038   static double dtanh(double x)    { double k = ::tanh(x); return 1.01-k*k; }
    00039   static double sigmoid(double x)  { return 1/(1+exp(-x)); }
    00040   static double dsigmoid(double x) { double k = sigmoid(x); return k*(1-k); }
    00041
    00042 };
    00043
    00044
    00045 #endif