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

RadialBasisNetwork Class Reference

A Radial Basis Function Neural Network. More...

#include <RadialBasisNetwork.h>

Inheritance diagram for RadialBasisNetwork:

Inheritance graph
[legend]
Collaboration diagram for RadialBasisNetwork:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RadialBasisNetwork (int inputs, int centers, int outputs)
 Creates a Radial basis function network.

 RadialBasisNetwork (const char *filename)
 Loads a network from a text file.

 RadialBasisNetwork (RadialBasisNetwork &srcNet)
 Copy constructor, NOT YET IMPLEMENTED.

virtual ~RadialBasisNetwork ()
virtual void setCenter (uint i, Vector &center)
 Sets the ith center point to the given point.

virtual void setCenter (uint i, real *center)
 Sets the ith center point to the given point.

virtual Vector getCenter (int i) const
 Returns the point corresponding to the ith center.

virtual uint getCenterCount () const
 The number of centers in the network.

virtual void setBias (uint i, real bias)
 Sets the bias of the ith output.

virtual real getBias (uint i) const
 Returns the bias of the ith output.

virtual void removeBias (uint i)
 Prevents the ith output from having any bias.

virtual void setWeight (int center, int output, real weight)
 Sets the weight between the given center and output.

virtual real getWeight (int center, int output) const
 Returns the weight of the link between the given center and output.

virtual Vector getOutput (Vector &input)
 Returns the output of the network for the given input.

virtual Vector getOutput (real *input)
 Wrapper function to allow getOutput() to work for an array of real as input as well.

void setCenterActivationFunction (ActivationFunction f, ActivationFunction df)
 Sets the activation function of the center neurons.

void trainWeights (TrainingSet &T)
 Trains the weights of the network, centers are kept fixed.

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

virtual void save (const char *filename)
 Save the network to a text file.


Protected Attributes

int _nCenters
 Number of centers in the network.

InputLayer_inputLayer
 Layer of input. Each member is an InputNeuron.

Layer_centerLayer
 Layer of centers, each member is a CenterNEuron.

Layer_outputLayer
 Layer of output, each member if a SimpleNeuron.


Detailed Description

A Radial Basis Function Neural Network.

The network consists of a layer of N-inputs, then h-(N-dimensional) centers, and some outputs. The default activation function for the centers is gaussian(), which is the gaussian distribution function with sigma = 1. If you want to change that then you'll have to write your own activation function and change it with setCenterActivationFunction(). The output neurons use the identity() function as the activation function, thus the output is simply the weighted sum of the outputs of the centers.

There are atleast two ways to train a radial basis network.

One involves fixed centers and training the weights only in order to minimize the error over a training set. The other involves using the gradient descent rule to adjust both centers and weights. Currently only the former is implemented in annie using trainWeights().

See also:
trainWeights
Todo:
Implement gradient-descent rule based updation of centers and weights

The copy constructor


Constructor & Destructor Documentation

RadialBasisNetwork int  inputs,
int  centers,
int  outputs
 

Creates a Radial basis function network.

All the outputs will have a bias.

Parameters:
inputs Number of inputs taken in by the network
centers Number of centers the network has. Each center will be an inputs-dimensional point
outputs The number of outputs given by the neuron. All of them will have a bias

RadialBasisNetwork const char *  filename  ) 
 

Loads a network from a text file.

See also:
save
Parameters:
filename Name of the file from which to load network structure
Exceptions:
Exception On any error

RadialBasisNetwork RadialBasisNetwork srcNet  ) 
 

Copy constructor, NOT YET IMPLEMENTED.

virtual ~RadialBasisNetwork  )  [virtual]
 


Member Function Documentation

virtual real getBias uint  i  )  const [virtual]
 

Returns the bias of the ith output.

Parameters:
i The index of the output (0<=i<getOutputCount()).
Returns:
The bias of the output. If there is no bias, it returns 0.0

virtual Vector getCenter int  i  )  const [virtual]
 

Returns the point corresponding to the ith center.

Parameters:
i The center whose point is wanted
Returns:
The getInputCount() dimensional point corresponding to the ith center

virtual uint getCenterCount  )  const [virtual]
 

The number of centers in the network.

virtual const char* getClassName  )  const [virtual]
 

Returns "RadialBasisNetwork".

Implements Network.

virtual Vector getOutput real input  )  [virtual]
 

Wrapper function to allow getOutput() to work for an array of real as input as well.

Does exactly the same thing as Network::getOutput(real*).

Reimplemented from Network.

virtual Vector getOutput Vector input  )  [virtual]
 

Returns the output of the network for the given input.

Parameters:
input A vector of getDimension() reals
Returns:
The corresponding output of the network

virtual real getWeight int  center,
int  output
const [virtual]
 

Returns the weight of the link between the given center and output.

Parameters:
center Index of the center (0<=center<getCenterCount()).
output Index of the output (0<=output<getOutputCount()).
Exceptions:
Exception if any of the parameters given is invalid

virtual void removeBias uint  i  )  [virtual]
 

Prevents the ith output from having any bias.

Parameters:
i The index of the output (0<=i<getOutputCount()).
Exceptions:
Exception if the index given is invalid

virtual void save const char *  filename  )  [virtual]
 

Save the network to a text file.

virtual void setBias uint  i,
real  bias
[virtual]
 

Sets the bias of the ith output.

Parameters:
i The index of the output (0<=i<getOutputCount()).
bias The bias to be given to that output.
Exceptions:
Exception if that neuron isn't allowed to be biased.

virtual void setCenter uint  i,
real center
[virtual]
 

Sets the ith center point to the given point.

Parameters:
i The center that is to be changed
center The getInputCount() dimensional point

virtual void setCenter uint  i,
Vector center
[virtual]
 

Sets the ith center point to the given point.

Parameters:
i The center that is to be changed
center The getInputCount() dimensional point

void setCenterActivationFunction ActivationFunction  f,
ActivationFunction  df
 

Sets the activation function of the center neurons.

(The activation function is gaussian by default)

Parameters:
f The activation function to be used.
df The derivation of the activation function, used in gradient descent training

virtual void setWeight int  center,
int  output,
real  weight
[virtual]
 

Sets the weight between the given center and output.

Parameters:
center Index of the center (0<=center<getCenterCount()).
output Index of the output (0<=output<getOutputCount()).
weight The weight to give to the link between the center and output.
Exceptions:
Exception if any of the parameters given is invalid

void trainWeights TrainingSet T  ) 
 

Trains the weights of the network, centers are kept fixed.

Parameters:
T The TrainingSet from which input/desired-output pairs will be obtained


Member Data Documentation

Layer* _centerLayer [protected]
 

Layer of centers, each member is a CenterNEuron.

InputLayer* _inputLayer [protected]
 

Layer of input. Each member is an InputNeuron.

int _nCenters [protected]
 

Number of centers in the network.

If you plan to extend this class, then the onus of keeping this value consistent lies on you

Layer* _outputLayer [protected]
 

Layer of output, each member if a SimpleNeuron.


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