Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Terminator Class Reference

Abstract superclass for early stopping strategies for AnyNetwork. More...

#include <termination.h>

Inheritance diagram for Terminator:

DummyTerminator SavingTerminator TerminatorT800 GLTerminator PQTerminator UPTerminator UPTerminator PRTerminator List of all members.

Public Methods

 Terminator (const PatternSet &validationset, int striplen)
bool validate (const ANNetwork &net, Trainer &trainer, int cyclesTrained)
virtual bool restore (ANNetwork &net)
double generalizationLoss (double min=-666, double opt=-666) const
double validationError () const
double minimumError () const
int howManyTrained () const

Protected Attributes

double mMinValidError
int mMinCycle
double mLastValidError
const PatternSetmValidationSet
int mStripLength

Detailed Description

Abstract superclass for early stopping strategies for AnyNetwork.

The idea behing early stopping is as follows. When neural networks are trained with a training set, they often learn the training set so well that they "overfit" to it and start behaving badly with other patterns. With early stopping we try to stop the learning at the time when the networks starts to generalize badly. Generalization ability is tested with a separate validation set.

Terminates the subject when it is about to learn too much.

Definition at line 52 of file termination.h.


Constructor & Destructor Documentation

Terminator const PatternSet   validationset,
int    striplen
 

Standard constructor.

Parameters:
validationset  Validation set that is used for measuring the generalization ability of the neural network taught with the separate training data.
striplen  Interval of training cycles between validation and thus early stopping test.

Definition at line 69 of file termination.cc.

References mLastValidError, mMinCycle, and mMinValidError.


Member Function Documentation

double generalizationLoss double    min = -666,
double    opt = -666
const
 

Returns the current generalization loss (GL), OR calculates it for the given parameters, if given.

Parameters:
min  OPTIONAL Lowest validation MSE measured so far.
opt  OPTIONAL Optimal validation MSE measured so far. [TODO: check this]

Definition at line 75 of file termination.cc.

References mLastValidError, and mMinValidError.

Referenced by Trainer::train(), and validate().

int howManyTrained   const [inline]
 

Returns the number of training cycles the network has been trained before the minimum validation error point.

Definition at line 103 of file termination.h.

References mMinCycle.

Referenced by Trainer::train().

double minimumError   const [inline]
 

Returns the lowest measured validation error.

Definition at line 98 of file termination.h.

References mMinValidError.

Referenced by Trainer::train().

virtual bool restore ANNetwork   net [inline, virtual]
 

Restores the network state state in Terminator::validate().

The most important implementor of this method is SavingTerminator::restore().

Returns:
Value 'true' if an earlier network state was restored, 'false' if not.
See also:
SavingTerminator

Reimplemented in SavingTerminator.

Definition at line 84 of file termination.h.

Referenced by Trainer::train().

bool validate const ANNetwork   net,
Trainer   trainer,
int    cyclesTrained
 

Tests the networks with the validation set and returns 'true' if the training should be terminated.

The Terminator::restore method should be called to restore the optimal network state.

See also:
SavingTerminator

Definition at line 82 of file termination.cc.

References generalizationLoss(), mLastValidError, mValidationSet, Trainer::setGeneralizLoss(), and Learner::test().

Referenced by Trainer::train().

double validationError   const [inline]
 

Returns the last measured validation error.

Definition at line 95 of file termination.h.

References mLastValidError.

Referenced by Trainer::train().


Member Data Documentation

double mLastValidError [protected]
 

Last validation error.

Definition at line 113 of file termination.h.

Referenced by generalizationLoss(), Terminator(), validate(), and validationError().

int mMinCycle [protected]
 

The number of training cycles at minimum.

Definition at line 110 of file termination.h.

Referenced by howManyTrained(), SavingTerminator::save(), and Terminator().

double mMinValidError [protected]
 

Smalled validation error so far.

Definition at line 107 of file termination.h.

Referenced by generalizationLoss(), minimumError(), and Terminator().

int mStripLength [protected]
 

Validation interval.

Definition at line 119 of file termination.h.

const PatternSet& mValidationSet [protected]
 

Validation pattern set.

Definition at line 116 of file termination.h.

Referenced by validate().


The documentation for this class was generated from the following files:
Generated on Thu Feb 10 20:06:46 2005 for Inanna by doxygen1.2.18