#include <SquaredError.h>

Public Member Functions | |
| double | error (Model &model, const Array< double > &in, const Array< double > &out) |
| Calculates the squared error between the output and the target vector. | |
| double | errorDerivative (Model &model, const Array< double > &in, const Array< double > &out, Array< double > &derivative) |
| Calculates the derivatives of the squared error with respect to the parameters ModelInterface::w. | |
These methods can be used as error measure model for the learning process.
Definition at line 72 of file SquaredError.h.
| double SquaredError::error | ( | Model & | model, | |
| const Array< double > & | in, | |||
| const Array< double > & | out | |||
| ) | [inline, virtual] |
Calculates the squared error between the output and the target vector.
Measures the euklidian distance between the model output model(in), calculated from the input vector in, and the target vector out. Consider the case of a N-dimensional output vector, i.e. a neural network with N output neurons, and a set of P patterns. In this case the function calculates
| in | Input vector for the model. | |
| out | Target vector. |
Implements ErrorFunction.
Definition at line 102 of file SquaredError.h.
References Model::model().
| double SquaredError::errorDerivative | ( | Model & | model, | |
| const Array< double > & | in, | |||
| const Array< double > & | out, | |||
| Array< double > & | derivative | |||
| ) | [inline, virtual] |
Calculates the derivatives of the squared error with respect to the parameters ModelInterface::w.
According to the equation in the description for the function error the derivatives of the squared error can be calculated with
The results are written to the vector ModelInterface::dedw.
Usually, as a byproduct of the calculation of the derivative one gets the the error
itself very efficiently. Therefore, the method error gives back this value. This additional effect can be switched of by means of the third parameter (returnError = false).
| in | Input vector for the model. | |
| out | The target vector. | |
| returnError | Determines whether or not to calculate the error itself. By default the error is calculated. |
Reimplemented from ErrorFunction.
Definition at line 166 of file SquaredError.h.
References Model::getParameterDimension(), i, and Model::modelDerivative().