Neuron Class Reference

#include <Neuron.h>

List of all members.

Public Member Functions

 Neuron (int numInputs) throw (std::bad_alloc)
 Neuron (const Neuron &neuron) throw (std::bad_alloc)
Neuronoperator= (const Neuron &neuron) throw (std::bad_alloc)
void SetNumInputs (int num)
int GetNumInputs () const
void SetActivationFunc (ACTIVATION_FUNC activ_func)
void SetDerivActivationFunc (DERIV_ACTIVATION_FUNC deriv)
void SetWeight (int indx, double weight)
void SetWeights (const std::vector< double > &weights)
double GetWeight (int indx) const
void GetWeights (std::vector< double > &weights) const
double * GetWeights ()
double GetOutput (const std::vector< double > &inputs, const int *indices)
double GetOutput (const std::vector< double > &inputs, const int *indices, double &net_input)
double GetOutput (const double *inputs, const int *indices)
double GetOutput (const double *inputs, const int *indices, double &net_input)
void SetIndex (int i)
int GetIndex () const
void Clear ()

Public Attributes

ACTIVATION_FUNC pActivationFunc
DERIV_ACTIVATION_FUNC pDerivActivationFunc


Detailed Description

Neuron class This class describes the representation of neuron: the basic building block of neural networks. It consists of a set of inputs (which can be hooked to other neurons), and corresponding weights for the inputs. The bias should be included in the weights, and the corresponding input set to -1. The neuron computes its output and returns that from GetOutput. Each call to GetOutput will recompute the output. So if the inputs to neuron have not changed since the last call, do not make repeated calls to GetOutput for efficiency. Instead, store it somewhere and reuse. For instance, NeuralNetwork class stores the output from neurons because it needs to use this output of input neurons to copute activations and outputs of hidden neurons.


Constructor & Destructor Documentation

Neuron::Neuron int  numInputs  )  throw (std::bad_alloc)
 

Constructs the neuron with specified number of input connections. numInputs: Number of inputs to the neuron


Member Function Documentation

void Neuron::Clear  ) 
 

Deallocates space for weights of the neuron and clears up member variables so that neuron can be redefined using SetNumInputs and SetWeights

double* Neuron::GetWeights  )  [inline]
 

the function below should not be const because it is used by calibrators to update neuron weights

void Neuron::SetNumInputs int  num  ) 
 

Set number of inputs to neuron

void Neuron::SetWeight int  indx,
double  weight
 

Gets the weight for specified input connection. Does not validate bounds. indx >= 0 and indx < iNumFrom


Member Data Documentation

ACTIVATION_FUNC Neuron::pActivationFunc
 

Activation function pointer If all neurons in the network use same activation function, compile this class with SAME_ACTIVATION flag defined. This will save space (will not allocate different pointers to funtions for different neurons.

DERIV_ACTIVATION_FUNC Neuron::pDerivActivationFunc
 

Derivative of activation function


The documentation for this class was generated from the following files:
Generated on Sun Aug 24 17:33:41 2008 by  doxygen 1.4.6