DF_MeanSquaredError Class Reference

Mean Squared Error, using the GeneralDerivative interface. More...

#include <DF_MeanSquaredError.h>

Inheritance diagram for DF_MeanSquaredError:

ErrorFunction

List of all members.

Public Member Functions

double error (Model &model, const Array< double > &input, const Array< double > &target)
 Calculates the mean squared error between the output and the target vector.
double errorDerivative (Model &model, const Array< double > &input, const Array< double > &target, Array< double > &derivative)
 Calculates the derivatives of the mean squared error with respect to the parameters ModelInterface::w.

Public Attributes

Array< double > output
Array< double > locerr


Detailed Description

Mean Squared Error, using the GeneralDerivative interface.

Definition at line 51 of file DF_MeanSquaredError.h.


Member Function Documentation

double DF_MeanSquaredError::error ( Model model,
const Array< double > &  input,
const Array< double > &  target 
) [inline, virtual]

Calculates the mean 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 target. The result is then normalized to the number of output neurons. 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

\[ E = \frac{1}{NP} \sum_{p=1}^P\sum_{i=1}^N(model(output)_{i}^{p} - target_{i}^{p})^{2} \]

Parameters:
input Input vector for the model.
target Target vector.
Returns:
The mean squared error E.
Author:
B. Sendhoff
Date:
1999
Changes
C. Igel, M. Toussaint, 2001-09-13:
Normalising now with no. of output neurons and no. of patterns.
Status
stable

Implements ErrorFunction.

Definition at line 87 of file DF_MeanSquaredError.h.

References Model::model(), and output.

double DF_MeanSquaredError::errorDerivative ( Model model,
const Array< double > &  input,
const Array< double > &  target,
Array< double > &  derivative 
) [inline, virtual]

Calculates the derivatives of the mean squared error with respect to the parameters ModelInterface::w.

According to the equation in the description for the function error the derivatives of the mean squared error can be calculated The results are written to the vector ModelInterface::dedw.

Usually, as a byproduct of the calculation of the derivative one gets the the error $E$ 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).

Parameters:
input Input vector for the model.
target The target vector.
returnError Determines whether or not to calculate the error itself. By default the error is calculated.
Returns:
The error E if returnError is set to "true", "-1" otherwise.
Author:
B. Sendhoff
Date:
1999
Changes
C. Igel, M. Toussaint, 2001-09-13:
Normalising now with no. of output neurons and no. of patterns.
Status
stable

Reimplemented from ErrorFunction.

Definition at line 149 of file DF_MeanSquaredError.h.

References Model::generalDerivative(), Model::getParameterDimension(), locerr, Model::model(), and output.


Member Data Documentation

Definition at line 194 of file DF_MeanSquaredError.h.

Referenced by errorDerivative().

Definition at line 193 of file DF_MeanSquaredError.h.

Referenced by error(), and errorDerivative().


The documentation for this class was generated from the following file: