00001 #ifndef _RECURRENTNEURON_H 00002 #define _RECURRENTNEURON_H 00003 00004 #include "SimpleNeuron.h" 00005 #include "defines.h" 00006 #include <vector> 00007 00008 namespace annie 00009 { 00010 00032 class RecurrentNeuron : public SimpleNeuron 00033 { 00034 public: 00042 RecurrentNeuron(int label, real bias, real activation=0.); 00043 00044 void setActivationFunction(ActivationFunction f) { _activationFunction = f; _outputCache = _activationFunction(_activationCache); } 00045 00049 virtual void update(); 00050 00051 #define NONSENSE { ASSERT(0); throw Exception("Doesn't have sense in RecurrentNeuron"); } 00052 virtual void invalidateOutputCache() {} 00053 00059 virtual real getOutput() const ; 00060 00062 virtual const char* getClassName() const { return _RECURRENT_NEURON_STRING; } 00063 00067 virtual void reset(real initialActivation); 00068 00070 virtual void calculateNewWeights(real learningRate) NONSENSE 00071 00072 00074 virtual void setDesiredOutput(real desired) NONSENSE 00075 protected: 00076 virtual void _recacheOutput() const {} 00077 real _bias; 00078 }; 00079 00080 }; //namespace annie 00081 #endif // define _RECURRENTNEURON_H 00082