ValidationError Class Reference

Error on a hold out set. More...

#include <ValidationError.h>

Inheritance diagram for ValidationError:

ErrorFunction

List of all members.

Public Member Functions

 ValidationError (ErrorFunction *base, Optimizer *opt, int iter, double holdOutFraction=0.2)
 Constructor.
 ~ValidationError ()
 Descructor.
double error (Model &model, const Array< double > &input, const Array< double > &target)
 Hold-out error computation:.
double errorDerivative (Model &model, const Array< double > &input, const Array< double > &target, Array< double > &derivative)
 Hold-out error computation: The data are split into training and validation datasets.

Protected Attributes

ErrorFunctionbaseError
 error function for training and evaluation
Optimizeroptimizer
 optimizer for machine training
int iterations
 number of training iterations
double holdOut
 fraction of the data used for evaluation


Detailed Description

Error on a hold out set.

First, the data are split into training and validation datasets. Then a model is trained on the training subset with a given base error function and a given optimizer for a predefined number of iterations. Finally the error on the validation set is reported.

Definition at line 63 of file ValidationError.h.


Constructor & Destructor Documentation

ValidationError::ValidationError ( ErrorFunction base,
Optimizer opt,
int  iter,
double  holdOutFraction = 0.2 
)

Constructor.

Parameters:
base error function for machine training and evaluation of the validation set
opt optimizer for machine training
iter number of optimization iterations
holdOutFraction fraction of the data in the hold out set

Definition at line 50 of file ValidationError.cpp.

References baseError, holdOut, iterations, and optimizer.

ValidationError::~ValidationError (  ) 

Descructor.

Definition at line 58 of file ValidationError.cpp.


Member Function Documentation

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

Hold-out error computation:.

Implements ErrorFunction.

Definition at line 63 of file ValidationError.cpp.

References baseError, ErrorFunction::error(), holdOut, i, Optimizer::init(), iterations, Optimizer::optimize(), and optimizer.

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

Hold-out error computation: The data are split into training and validation datasets.

The model is trained on the training subset with the given base error function and the given optimizer for the predefined number of iterations. The method reports the error on the validation set, including its derivative. Make sure that the derivative computation for the base error is implemented before using this function.

Reimplemented from ErrorFunction.

Definition at line 103 of file ValidationError.cpp.

References baseError, ErrorFunction::errorDerivative(), holdOut, i, Optimizer::init(), iterations, Optimizer::optimize(), and optimizer.


Member Data Documentation

error function for training and evaluation

Definition at line 93 of file ValidationError.h.

Referenced by error(), errorDerivative(), and ValidationError().

double ValidationError::holdOut [protected]

fraction of the data used for evaluation

Definition at line 102 of file ValidationError.h.

Referenced by error(), errorDerivative(), and ValidationError().

int ValidationError::iterations [protected]

number of training iterations

Definition at line 99 of file ValidationError.h.

Referenced by error(), errorDerivative(), and ValidationError().

optimizer for machine training

Definition at line 96 of file ValidationError.h.

Referenced by error(), errorDerivative(), and ValidationError().


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