The input is a vector, but the output is a scalar.
This is a linear RBF model meaning that the center locations of the hidden nodes and the number of nodes do not change. There is a weight-decay correction (ridge regression) to obtain a smooth approximation to the input and to hopefully prevent over-fit.
Public Types | |
typedef std::vector< double > | Input |
Public Member Functions | |
LinearRBF (const std::vector< Input > &rbfCenters, double influence_radius, double weight_decay_coeff=0.5) | |
LinearRBF (const std::vector< Input > &inputs, const std::vector< double > &outputs, Strategy &strategy, double weight_decay_coeff=0.5) | |
Finds the centers based on the strategy passed in, and trains to those centers. | |
void | setTrainingInput (const std::vector< Input > &inputs, const std::vector< double > &outputs) |
Process a group of inputs and their corresponding outputs. | |
double | getOutput (const Input &input) const |
You can ask a trained RBF for the output given an input. | |
void | addTrainingInput (const Input &input, double output) |
Add just one more training input-output pair. | |
const std::vector< Input > & | getCenters () const |
double | getInfluenceRadius () const |
Classes | |
class | DataDrivenUniformStrategy |
Uniformly spaced centers, but uses the minbounds and maxbounds computed from the data. More... | |
class | KMeansStrategy |
Uses k-means clustering to choose the best k centers based on the training data. More... | |
class | Strategy |
Abstract base class of strategies to find centers and influence radius from the training data itself. More... | |
class | UniformStrategy |
Pass in the min, max and required number of centers for each of the components of the input vector to get a vector of uniformly spaced centers. More... |
typedef std::vector<double> w2img::LinearRBF::Input |
w2img::LinearRBF::LinearRBF | ( | const std::vector< Input > & | rbfCenters, | |
double | influence_radius, | |||
double | weight_decay_coeff = 0.5 | |||
) |
rbfCenters | Provide the centers to use for the linear RBF. You can set these centers to be uniformly spaced in the input space, by using the helper function getUniformCenters(). | |
influence_radius | What is the radius of influence of each basis vector? You can choose to make the vector overlapping ( 2xcenter_spacing, for example) or not. | |
lambda | How smooth an approximation do you want? The larger the lambda, the smoother the approximation. |
w2img::LinearRBF::LinearRBF | ( | const std::vector< Input > & | inputs, | |
const std::vector< double > & | outputs, | |||
Strategy & | strategy, | |||
double | weight_decay_coeff = 0.5 | |||
) |
Finds the centers based on the strategy passed in, and trains to those centers.
void w2img::LinearRBF::addTrainingInput | ( | const Input & | input, | |
double | output | |||
) |
Add just one more training input-output pair.
Instead of retraining the entire network, this computes the weights based on previous results.
Note that if you want to replace the present inputs, you should call setTrainingInput
WARNING! Not implemented.
const std::vector<Input>& w2img::LinearRBF::getCenters | ( | ) | const [inline] |
double w2img::LinearRBF::getInfluenceRadius | ( | ) | const [inline] |
double w2img::LinearRBF::getOutput | ( | const Input & | input | ) | const |
You can ask a trained RBF for the output given an input.
void w2img::LinearRBF::setTrainingInput | ( | const std::vector< Input > & | inputs, | |
const std::vector< double > & | outputs | |||
) |
Process a group of inputs and their corresponding outputs.
the two vectors have to be the same size, obviously.
It is much more efficient to call this method once than the addTrainingInput multiple times.
The network is retrained with these inputs. The old weights are discarded.