Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

AbstractNeuron Class Reference

Implementation helper for common types of Neurons. More...

#include <AbstractNeuron.h>

Inheritance diagram for AbstractNeuron:

Inheritance graph
[legend]
Collaboration diagram for AbstractNeuron:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AbstractNeuron (int label, bool hasBias=true)
 Creates a simple neuron with the given label.

virtual void setBias (real bias)
 Sets the bias of the neuron.

virtual bool hasBias () const
 Is the neuron allowed to have a bias?

virtual real getBias () const
 The bias of the neuron, 0.0 if it's not allowed to have a bias.

virtual void removeBias ()
 Sets bias to 0.0 and prevents the neuron from having a bias.

virtual void setDesiredOutput (real desired)=0
 Sets the desired output of the neuron.

virtual void connect (Neuron *from)
 Connects the given neuron to this one, i.e., the output of the supplied neuron will be given as input to this neuron.

void connect (Neuron &from)
void connect (Neuron &from, real w)
void connectFrom (Neuron *from)
 TODO: rename the above...

virtual void connect (Neuron *from, real weight)
 Connects the given neuron to this one, i.e., the output of the supplied neuron will be given as input to this neuron.

virtual void calculateNewWeights (real learningRate, real momentum)
 Calculates the adjustment to incoming weights based on the gradient descent rule (backpropagation).

virtual void update ()
 Updates the weights of incoming connections according to the values calculated using the gradient descent rule.

virtual const char * getClassName () const
 Returns "AbstractNeuron".

virtual real getWeight (Neuron *from) const
 Returns the weight of the link between the provided neuron and this neuron.

void randomizeWeights ()
virtual operator std::string () const
 Neuron::string().


Static Public Member Functions

real getRandomWeight ()

Protected Member Functions

virtual void _recacheOutput () const=0
 Neuron::_recacheOutput.

virtual void _recacheError () const=0
 Neuron::_recacheError.


Protected Attributes

bool _hasBias
 Is this neuron allowed to have a bias?

real _bias
 If allowed to have a bias then the bias, otherwise 0.0.

real _deltaBias
 The change in bias, calculated using the gradient descent rule.


Static Protected Attributes

const real INIT_WEIGHT_MAX

Detailed Description

Implementation helper for common types of Neurons.

Has everything except activation function, which is defined in offsprings.

Note: rather than adding more virtual functions for activation function and derivation, we make virtual recaching functions. This should be more efficient in the performance-critical parts.


Constructor & Destructor Documentation

AbstractNeuron int  label,
bool  hasBias = true
 

Creates a simple neuron with the given label.

Parameters:
label The label to be given to the neuron
hasBias true if the neuron is allowed to have a bias, false otherwise. Default is true
See also:
removeBias


Member Function Documentation

virtual void _recacheError  )  const [protected, pure virtual]
 

Neuron::_recacheError.

Implements Neuron.

Implemented in SimpleNeuron.

virtual void _recacheOutput  )  const [protected, pure virtual]
 

Neuron::_recacheOutput.

Implements Neuron.

Implemented in KohonenNeuron, and SimpleNeuron.

virtual void calculateNewWeights real  learningRate,
real  momentum
[virtual]
 

Calculates the adjustment to incoming weights based on the gradient descent rule (backpropagation).

Doesn't actually update the weights, just sets the value.

See also:
update

virtual void connect Neuron from,
real  weight
[virtual]
 

Connects the given neuron to this one, i.e., the output of the supplied neuron will be given as input to this neuron.

The weight of the link will be the one supplied.

Parameters:
from The neuron whose output is to be taken as input
weight The weight of the connection

void connect Neuron from,
real  w
[inline]
 

Here is the call graph for this function:

void connect Neuron from  )  [inline]
 

Here is the call graph for this function:

virtual void connect Neuron from  )  [virtual]
 

Connects the given neuron to this one, i.e., the output of the supplied neuron will be given as input to this neuron.

A random weight is provided to the link

Parameters:
from The neuron whose output is to be taken is as input

void connectFrom Neuron from  )  [inline]
 

TODO: rename the above...

Here is the call graph for this function:

virtual real getBias  )  const [virtual]
 

The bias of the neuron, 0.0 if it's not allowed to have a bias.

virtual const char* getClassName  )  const [virtual]
 

Returns "AbstractNeuron".

Implements Neuron.

Reimplemented in RecurrentNeuron, and SimpleNeuron.

real getRandomWeight  )  [static]
 

virtual real getWeight Neuron from  )  const [virtual]
 

Returns the weight of the link between the provided neuron and this neuron.

Parameters:
from The neuron whose output is connected to this neuron's input
Returns:
The weight of the connection, 0.0 if no connection exists

Reimplemented from Neuron.

virtual bool hasBias  )  const [virtual]
 

Is the neuron allowed to have a bias?

virtual operator std::string  )  const [virtual]
 

Neuron::string().

Reimplemented from Neuron.

void randomizeWeights  ) 
 

Reimplemented in KohonenNeuron.

virtual void removeBias  )  [virtual]
 

Sets bias to 0.0 and prevents the neuron from having a bias.

virtual void setBias real  bias  )  [virtual]
 

Sets the bias of the neuron.

Parameters:
bias The bias to be given to the neuron
Exceptions:
Exception if the neuron is not allowed to have a bias

virtual void setDesiredOutput real  desired  )  [pure virtual]
 

Sets the desired output of the neuron.

Should be called only for output neurons, i.e., those whose output is not connected to anyone else. Setting the desired output at these neurons will form the basis of error backpropagation

Parameters:
desired The desired output of this neuron
Exceptions:
Exception if the neuron is not an output neuron

Implemented in ParametrizedNeuron, and SimpleNeuron.

virtual void update  )  [virtual]
 

Updates the weights of incoming connections according to the values calculated using the gradient descent rule.

See also:
calculateNewWeights

Reimplemented in RecurrentNeuron.


Member Data Documentation

real _bias [protected]
 

If allowed to have a bias then the bias, otherwise 0.0.

Reimplemented in RecurrentNeuron.

real _deltaBias [protected]
 

The change in bias, calculated using the gradient descent rule.

bool _hasBias [protected]
 

Is this neuron allowed to have a bias?

const real INIT_WEIGHT_MAX [static, protected]
 


The documentation for this class was generated from the following file:
Generated on Fri Jun 18 13:18:52 2004 for Annie by doxygen 1.3.5