// $Id$ // // File: nnann_weight.h // Created: Sat Apr 2 21:10:00 EDT 2011 // Creator: davidl (on Darwin Amelia.local 9.8.0 i386) // #ifndef _nnann_weight_ #define _nnann_weight_ // The nnann_weight class represents a connection between two neurons in neighboring layers. // This object provides a somewhat symmetric view of the neurons making it easier to propagate // either forward or backward (for training). class nnann_neuron; class nnann_weight{ public: nnann_weight(){} virtual ~nnann_weight(){} void BackPropagate(void){input->AddToOutputError(output->GetInputError()*weight);} nnann_neuron* GetInput(void){return input;} nnann_neuron* GetOutput(void){return output;} double GetWeight(void){return weight;} void ForwardPropagate(void){output->AddToInput(input->GetOutput()*weight);} void SetInput(nnann_neuron *input){this->input = input;} void SetOutput(nnann_neuron *output){this->output = output;} void SetWeight(double weight){this->weight = weight;} protected: nnann_neuron *input; nnann_neuron *output; double weight; private: }; #endif // _nnann_weight_