From 7c3c5dd0f8d7089bd50282e9dcd56e36798e18cf Mon Sep 17 00:00:00 2001 From: Georg Holzmann Date: Tue, 12 Jul 2005 14:40:21 +0000 Subject: initial commit of pix_recNN svn path=/trunk/externals/grh/; revision=3320 --- pix_recNN/RecurrentNeuron.h | 149 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100755 pix_recNN/RecurrentNeuron.h (limited to 'pix_recNN/RecurrentNeuron.h') diff --git a/pix_recNN/RecurrentNeuron.h b/pix_recNN/RecurrentNeuron.h new file mode 100755 index 0000000..ee87068 --- /dev/null +++ b/pix_recNN/RecurrentNeuron.h @@ -0,0 +1,149 @@ +///////////////////////////////////////////////////////////////////////////// +// +// class RecurrentNeuron +// +// this is an implementation of one neuron of a Recurrent Neural Network +// this neuron can have n input values, m values in it's memory and +// one output value +// (see NeuralNet documentations for more information) +// +// header file +// +// Copyright (c) 2005 Georg Holzmann +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +///////////////////////////////////////////////////////////////////////////// + + +#ifndef _INCLUDE_RECURRENT_NEURON_NET__ +#define _INCLUDE_RECURRENT_NEURON_NET__ + +#include +#include +#include "Neuron.h" + +namespace TheBrain +{ + +//------------------------------------------------------ +/* class of one neuron + */ +class RecurrentNeuron : public Neuron +{ + protected: + + /* this determines how much output values the net + * can remeber + * these values are fed back as new input + */ + int memory_; + + /* the weight matrix for the recurrent + * values (size: memory_) + */ + float *LW_; + + + public: + + /* Constructor + */ + RecurrentNeuron(int inputs, int memory); + + /* Destructor + */ + virtual ~RecurrentNeuron(); + + + //----------------------------------------------------- + /* some more get/set methods + */ + + virtual int getMemory() const + { return memory_; } + + virtual float *getLW() const + { return LW_; } + virtual float getLW(int index) const + { return LW_[index]; } + + virtual void setLW(const float *LW) + { for(int i=0; i