Cluster Class Reference

Define the common interface among Clusters. More...

Inheritance diagram for Cluster:

Inheritance graph
[legend]
Collaboration diagram for Cluster:

Collaboration graph
[legend]
List of all members.

Constructors

 Cluster (u_int numNeurons, const char *name="unnamed")
 Cluster (PropertySettings &prop)
virtual ~Cluster ()

Methods affecting whole Cluster

u_int numNeurons () const
bool needReset ()
void setAccumulate (bool mode)
bool isAccumulate () const
virtual void randomize (Real min, Real max)=0
Variant numNeuronsP ()
Variant accumP ()
bool setAccumP (const Variant &b)

Operations on Input's vector

virtual void setInput (u_int neuron, Real value)
virtual void setInputs (const RealVec &inputs)
virtual void setAllInputs (Real value)
virtual void resetInputs ()
virtual Real getInput (u_int neuron) const
RealVecinputs ()
const RealVecinputs () const
Variant inputsP ()
bool setInputsP (const Variant &v)

Operations on Output's vector

virtual void setOutput (u_int neuron, Real value)
virtual void setOutputs (const RealVec &outputs)
virtual Real getOutput (u_int neuron) const
RealVecoutputs ()
const RealVecoutputs () const
Variant outputsP ()
bool setOutputsP (const Variant &v)

Operations on OutputFunction

void setFunction (const OutputFunction &up)
OutputFunction *const getFunction () const
Variant getFunctionP ()
bool setFunction (const Variant &outf)
virtual Clusterclone () const

Protected Member Functions

void setNeedReset (bool b)

Detailed Description

Motivation
The Cluster class define the common interface amog Cluster. The subclasses may extends this interface for specific purpose (ex. SimpleCluster), but the BaseNeuralNet, the Linker and other classes depends only by this class. This abstraction allow to isolate the specific implementation of various classes
Description
The Cluster class represent an abstract group of neurons. There isn't a neuron class. The Cluster class represent a group of neurons as two arrays: inputs and outputs. The inputs array represent the inputs of the neurons 'contained' in the cluster, and the outputs of this neurons are calculated by appling the function provided by OutputFunction.
The number of neuron returned by size() method is also the dimension of inputs and outputs arrays
You can sets one subclasses of OutputFunction by setUpdater methods. If you don't specify an index when set a OutputFunction then this OutputFunction will be used to update the output of all neurons. Otherwise, you can specifiy different OutputFunction for different neuron.
 // create a SimpleCluster, a specialized subclass of Cluster
 SimpleCluster* simple = new SimpleCluster( 10 ); // this cluster contains 10 neurons
 // set the SigmoidUpdater for all neurons
 simple->setUpdater( SigmoidUpdater( 1.0 ) );
Warnings
For whose want to implement a subclass of Cluster: This class allocate the memory for inputs, outputs and updaters array. So, a subclass have to implements only the update method. The getInputs and getOutputs returns a valid array of internal data, and not simply a copy of the internal data. Look at the following code:
 RealVec& in = cluster->inputs();
 in[2] = 3.0;   // This statement will be changes the inputs of third neuron.
 // the above statements must be equivalent with the following
 cluster->setInput( 2, 3.0 );
The reasons behind this kind of behaviour its the efficiency!! When another class must do heavy calculation on all inputs of a Cluster (as MatrixLinker do), then its more efficient that it takes the array returned by inputs (or outputs) and works over them.
Properties
Name Type [isVector] Access mode Description Class
typename string read-only Class's type Propertized
name string read/write name of the object Updatable
accumulate boolean read/write if inputs are accumulated this
inputs RealVec read/write neuron's input this
outfunction OutputFunction read/write neuron's output function this
outputs RealVec read/write neuron's output this
numNeurons unsigned int read-only number of neurons this


Constructor & Destructor Documentation

Cluster ( u_int  numNeurons,
const char *  name = "unnamed" 
)

Construct a Cluster

Cluster ( PropertySettings prop  ) 

Construct a Cluster with PropertySettings

virtual ~Cluster (  )  [virtual]

Destructor


Member Function Documentation

u_int numNeurons (  )  const [inline]

Return the number of neurons (the length of input and output arrays)

bool needReset (  )  [inline]

Return true if inputs needs a reset

void setAccumulate ( bool  mode  )  [inline]

Enable/Disable accumulation mode
If accumulation is enabled (true) then linkers attached to this Cluster will never resetInput and accumulates data, otherwise the inputs will be resetted at each step of neural network

bool isAccumulate (  )  const [inline]

return true if the Cluster will accumulates inputs

virtual void randomize ( Real  min,
Real  max 
) [pure virtual]

Randomize the parameters of the Cluster
The parameters randomized by this method will be specified by sub-classes

Implemented in BiasedCluster, DDECluster, FakeCluster, and SimpleCluster.

Variant numNeuronsP (  )  [inline]

Read Access to property 'size'

Variant accumP (  )  [inline]

Read Access to property 'accumulate'

bool setAccumP ( const Variant b  )  [inline]

Write Access to property 'accumulate'

virtual void setInput ( u_int  neuron,
Real  value 
) [virtual]

Set the input of neuron Details...

virtual void setInputs ( const RealVec inputs  )  [virtual]

Set the inputs from the vector given

virtual void setAllInputs ( Real  value  )  [virtual]

Set all the inputs with the same value Details...

virtual void resetInputs (  )  [virtual]

Reset the inputs of this cluster, typically this means that the inputs will be set to zero. Details...

virtual Real getInput ( u_int  neuron  )  const [virtual]

Get the input of neuron

RealVec& inputs (  )  [inline]

Get the array of inputs
Return the array of inputs, not a copy of inputs; Then you can change inputs by the pointer returned !!!

const RealVec& inputs (  )  const [inline]

const version of inputs()

Variant inputsP (  )  [inline]

For property 'inputs'

bool setInputsP ( const Variant v  )  [inline]

setting the property 'inputs'

virtual void setOutput ( u_int  neuron,
Real  value 
) [virtual]

Force the output of the neuron at value specified

virtual void setOutputs ( const RealVec outputs  )  [virtual]

Set the outputs from the vector given

virtual Real getOutput ( u_int  neuron  )  const [virtual]

Get the output of neuron

RealVec& outputs (  )  [inline]

Get the array of outputs
Return the array of outputs, not a copy of outputs; Then you can change outputs by the pointer returned !!!

const RealVec& outputs (  )  const [inline]

const version of outputs()

Variant outputsP (  )  [inline]

For property 'outputs'

bool setOutputsP ( const Variant v  )  [inline]

setting the property 'outputs'

void setFunction ( const OutputFunction up  ) 

Set the output function for all neurons contained
This method create an internal copy of the OutputFunction passed

Warning:
This function delete the previous updater class registered !!!

OutputFunction* const getFunction (  )  const [inline]

Get the Output function

Variant getFunctionP (  )  [inline]

read property 'outfunction'

bool setFunction ( const Variant outf  )  [inline]

sets the property 'outfunction'

virtual Cluster* clone (  )  const [virtual]

Clone this Cluster

Reimplemented from Propertized.

Reimplemented in BiasedCluster, DDECluster, FakeCluster, and SimpleCluster.

void setNeedReset ( bool  b  )  [inline, protected]

Set the state of 'needReset'
Used by subclassed into update implementation


The documentation for this class was generated from the following file:
BerliOS Developer Logo Valid XHTML 1.0 Transitional Valid CSS!