///////////////////////////////////////////////////////////////////////////// // // class LinNeuralNet // // this is an implementation of a simple linear neural net with one neuron // so this net has a Weight-Matrix IW and a bias vector b1 // this net can have n input values, but only one output value // (see NeuralNet documentations for more information) // // header file // // Copyright (c) 2004 Georg Holzmann // // For information on usage and redistribution, and for a DISCLAIMER OF ALL // WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. // ///////////////////////////////////////////////////////////////////////////// #ifndef _INCLUDE_LIN_NEURAL_NET__ #define _INCLUDE_LIN_NEURAL_NET__ #include #include //#include "m_pd.h" // for debug class LinNeuralNet { protected: /* this is the number of input values, which is * automatically the netsize and the size of IW */ int netsize_; /* the input weight matrix IW * (size: netsize ) */ float *IW_; /* the bias vector b1 */ float b1_; /* the learning rate of the net */ float learn_rate_; /* the range of the input values should be from 0 * to range_ * outputvalues are from -1 to 1 */ float range_; public: /* Constructor */ LinNeuralNet(int netsize); /* Destructor */ virtual ~LinNeuralNet(); //----------------------------------------------------- /* Set/Get learning rate */ virtual void setLearningRate(float learn_rate) { learn_rate_=learn_rate; } virtual float getLearningRate() const { return learn_rate_; } /* Set/Get range */ virtual void setRange(float range) { range_=range; } virtual float getRange() const { return range_; } /* some more get/set methods */ virtual int getNetsize() const { return netsize_; } virtual float *getIW() const { return IW_; } virtual void setIW(const float *IW) { for(int i=0; i