Offers the functions to create and to work with radial basis function network. More...
#include <RBFNet.h>
Public Member Functions | |
| void | read (std::istream &is) |
| Reads a network from the input stream "is". | |
| void | write (std::ostream &os) const |
| Writes a network to the output stream "os". | |
| RBFNet (unsigned numInput, unsigned numOutput, unsigned numHidden) | |
| Creates a Radial Basis Function Network. | |
| RBFNet (const std::string &filename) | |
| Creates a Radial Basis Function Network by reading information from file "filename". | |
| RBFNet (unsigned numInput, unsigned numOutput, unsigned numHidden, const Array< double > &_m, const Array< double > &_A, const Array< double > &_b, const Array< double > &_v) | |
| void | initRBFNet (const Array< double > &input, const Array< double > &target) |
| Initializes the Radial Basis Function Network. | |
| void | model (const Array< double > &input, Array< double > &target) |
| Evaluates the RBFN-Model and calculates the output values. | |
| void | setParameter (unsigned int index, double value) |
| Modifies a specific model parameter. | |
| void | modelDerivative (const Array< double > &input, Array< double > &derivative) |
| Calculates the derivatives of the model with respect to the weights and stores the results in ModelInterface::dmdw. | |
| void | modelDerivative (const Array< double > &input, Array< double > &output, Array< double > &derivative) |
| Calculates the derivatives of the model with respect to the weights and stores the results in ModelInterface::dmdw. Furthermode, the output of the model is evaluated. | |
| const Array< double > & | getWeights () const |
| Returns the weights of the connections between hidden and output neurons. | |
| const Array< double > & | getBias () const |
| Returns the bias of all output neurons. | |
| const Array< double > & | getCenter () const |
| Returns the centers of all hidden neurons. | |
| const Array< double > & | getVariance () const |
| Returns the variances of all hidden neurons. | |
| const unsigned | getNHidden () const |
| Returns the number of hidden neurons. | |
| void | setWeights (const Array< double > &_A) |
| Sets the weights of connections between hidden and output neurons. | |
| void | setBias (const Array< double > &_b) |
| Sets the bias of the output neurons. | |
| void | setCenter (const Array< double > &_m) |
| Sets the centers of the hidden neurons. | |
| void | setVariance (const Array< double > &_v) |
| Sets the variances of the hidden neurons. | |
Offers the functions to create and to work with radial basis function network.
Together with an error measure and an optimization algorithm class you can use this radial basis function network class to produce your own optimization tool. Radial Basis Function networks are especially used for classification tasks. For this purpose the class of models contains, besides the number of hidden neurons
, 4 different kinds of parameters: the centers of the hidden neurons
, the standard deviations of the hidden neurons
, the weights of the connections between the hidden neuron with index
and output neuron with index
and the bias
of the output neuron with index
. The output neuron with index
yields the following output, assuming a
-dimensional input vector
:
Definition at line 96 of file RBFNet.h.
| RBFNet::RBFNet | ( | unsigned | numInput, | |
| unsigned | numOutput, | |||
| unsigned | numHidden | |||
| ) | [inline] |
Creates a Radial Basis Function Network.
Constructor 1
This method creates a Radial Basis Function Network (RBFN) with numInput input neurons, numOutput output neurons and numHidden hidden neurons.
| numInput | Number of input neurons, equal to dimensionality of input space. | |
| numOutput | Number of output neurons, equal to dimensionality of output space. | |
| numHidden | Number of hidden neurons. |
Definition at line 130 of file RBFNet.h.
References Model::inputDimension, Model::outputDimension, and Model::parameter.
| RBFNet::RBFNet | ( | const std::string & | filename | ) | [inline] |
Creates a Radial Basis Function Network by reading information from file "filename".
Constructor 2
This method creates a Radial Basis Function Network (RBFN) which is definded in the file filename.
| filename | Name of the file the RBFN definition is read from. |
| RBFNet::RBFNet | ( | unsigned | numInput, | |
| unsigned | numOutput, | |||
| unsigned | numHidden, | |||
| const Array< double > & | _m, | |||
| const Array< double > & | _A, | |||
| const Array< double > & | _b, | |||
| const Array< double > & | _v | |||
| ) | [inline] |
Constructor 3
This method creates a Radial Basis Function Network (RBFN) with numInput input neurons, numOutput output neurons and numHidden hidden neurons and initializes the parameters.
| numInput | Number of input neurons, equal to dimensionality of input space. | |
| numOutput | Number of output neurons, equal to dimensionality of output space. | |
| numHidden | Number of hidden neurons. | |
| _m | centers | |
| _A | output weights | |
| _b | biases | |
| _v | variances |
Definition at line 215 of file RBFNet.h.
References Model::inputDimension, Model::outputDimension, and Model::parameter.
| const Array<double>& RBFNet::getBias | ( | ) | const [inline] |
| const Array<double>& RBFNet::getCenter | ( | ) | const [inline] |
Returns the centers of all hidden neurons.
The center values are contained in an 2-dimensional array. The element
is the
coordinate of the center of the
hidden neuron.
Definition at line 430 of file RBFNet.h.
Referenced by write().
| const unsigned RBFNet::getNHidden | ( | ) | const [inline] |
| const Array<double>& RBFNet::getVariance | ( | ) | const [inline] |
Returns the variances of all hidden neurons.
The variances are contained in an 2-dimensional array. The element
is the
coordinate of the variance of the
hidden neuron.
Definition at line 456 of file RBFNet.h.
Referenced by write().
| const Array<double>& RBFNet::getWeights | ( | ) | const [inline] |
Returns the weights of the connections between hidden and output neurons.
Returns an array containing the weights of the connections between hidden and output neurons. The array is a two-dimensional object, the element
is the weight of the connection from the
hidden neuron to the
output neuron.
Definition at line 378 of file RBFNet.h.
Referenced by write().
| void RBFNet::initRBFNet | ( | const Array< double > & | input, | |
| const Array< double > & | target | |||
| ) | [inline] |
Initializes the Radial Basis Function Network.
This method initializes the parameters of the RBFN-model. First, it performs a K-means-Clustering to determine the centers and variances of the hidden neurons. Thereafter, the connection weights and bias values are determined by means of a linear regression.
| input | Vector of input values. | |
| target | Vector of target values. |
Definition at line 260 of file RBFNet.h.
References Model::parameter.
| void RBFNet::model | ( | const Array< double > & | input, | |
| Array< double > & | target | |||
| ) | [inline, virtual] |
Evaluates the RBFN-Model and calculates the output values.
This method evaluates the RBFN and determines the output values based on the following formula:
| input | Vector of input values. | |
| target | Vector of target values. |
Implements Model.
Definition at line 292 of file RBFNet.h.
References Model::parameter.
| void RBFNet::modelDerivative | ( | const Array< double > & | input, | |
| Array< double > & | output, | |||
| Array< double > & | derivative | |||
| ) | [inline, virtual] |
Calculates the derivatives of the model with respect to the weights and stores the results in ModelInterface::dmdw. Furthermode, the output of the model is evaluated.
| input | Vector of input values. | |
| output | Vector of evaluated output values. |
Reimplemented from Model.
Definition at line 349 of file RBFNet.h.
References Model::parameter.
| void RBFNet::modelDerivative | ( | const Array< double > & | input, | |
| Array< double > & | derivative | |||
| ) | [inline, virtual] |
Calculates the derivatives of the model with respect to the weights and stores the results in ModelInterface::dmdw.
| input | Vector of input values. |
Reimplemented from Model.
Definition at line 323 of file RBFNet.h.
References Model::parameter.
| void RBFNet::read | ( | std::istream & | is | ) | [virtual] |
Reads a network from the input stream "is".
The number of input, output and hidden neurons, and also the center, variance, weight and bias matrices are read from the input stream is, memory for the internal net data structures is reserved and the weight and bias values are written to the parameter vector Model::parameter.
| is | The input stream. |
Reimplemented from Model.
Definition at line 668 of file RBFNet.h.
References i, Model::inputDimension, Model::outputDimension, Model::parameter, setBias(), setCenter(), setVariance(), and setWeights().
| void RBFNet::setBias | ( | const Array< double > & | _b | ) | [inline] |
Sets the bias of the output neurons.
This method sets the bias of the output neurons. The bias is described by means of an one-dimensional array, the element
is the bias of the
output neuron.
| _b | The new bias values. |
Definition at line 535 of file RBFNet.h.
References Model::parameter.
Referenced by read().
| void RBFNet::setCenter | ( | const Array< double > & | _m | ) | [inline] |
Sets the centers of the hidden neurons.
This method sets the centers of the hidden neurons. The centers are described by means of a two-dimensional array, the element
is the
coordinate of the center of the
hidden neuron.
| _m | The new center values. |
Definition at line 564 of file RBFNet.h.
References Model::parameter.
Referenced by read().
| void RBFNet::setParameter | ( | unsigned int | index, | |
| double | value | |||
| ) | [inline, virtual] |
Modifies a specific model parameter.
Reimplemented from Model.
Definition at line 299 of file RBFNet.h.
References Model::parameter.
| void RBFNet::setVariance | ( | const Array< double > & | _v | ) | [inline] |
Sets the variances of the hidden neurons.
This method sets the variances of the hidden neurons. The variances are described by means of a two-dimensional array, the element
is the
coordinate of the variance of the
hidden neuron.
| _v | The new variance values. |
Definition at line 593 of file RBFNet.h.
References Model::parameter.
Referenced by read().
| void RBFNet::setWeights | ( | const Array< double > & | _A | ) | [inline] |
Sets the weights of connections between hidden and output neurons.
Sets the weights of the connections between hidden and output neurons. The weights are described by means of a two-dimensional array, the element
is the weight of the connection from the
hidden neuron to the
output neuron.
| _A | The new weight values. |
Definition at line 507 of file RBFNet.h.
References Model::parameter.
Referenced by read().
| void RBFNet::write | ( | std::ostream & | os | ) | const [virtual] |
Writes a network to the output stream "os".
The number of input, output and hidden neurons and also the center, variance, weights and bias matrices are written to the output stream os.
| os | The output stream. | |
| net | The net that will be written to the output stream. |
Reimplemented from Model.
Definition at line 628 of file RBFNet.h.
References getBias(), getCenter(), getNHidden(), getVariance(), and getWeights().