The generalization loss calculates the relative increase of the validation error compared to the minimum training error. More...
#include <shark/Algorithms/StoppingCriteria/GeneralizationLoss.h>
Public Types | |
typedef ValidatedSingleObjectiveResultSet< PointType > | ResultSet |
Public Types inherited from shark::AbstractStoppingCriterion< ValidatedSingleObjectiveResultSet< PointType > > | |
typedef ValidatedSingleObjectiveResultSet< PointType > | ResultSet |
Public Member Functions | |
GeneralizationLoss (double maxLoss) | |
bool | stop (const ResultSet &set) |
void | reset () |
resets the internal state More... | |
double | value () const |
returns the current generalization loss More... | |
Protected Attributes | |
double | m_minTraining |
minimum training error More... | |
double | m_minValidation |
minimum validation error More... | |
double | m_maxLoss |
maximum loss allowed More... | |
double | m_gl |
current generalization loss More... | |
The generalization loss calculates the relative increase of the validation error compared to the minimum training error.
The generalization loss at iteration t is calculated as \( GL(t) 100 \left( \frac {E_v(t)} {\min_{t'} E_l(t')} -1 \right) \) where \( E_v \) is the validation error and \( E_l \) the training error. This is a good indicator for overfitting, since it measures directly the gap between the two values. This method stops when the generalization error is bigger than some predefined value. The disadvantage is, that when the training error is still changing much a big generalization loss might be repaired later on. So this method might stop to soon.
Terminology for this and other stopping criteria is taken from (and also see):
Lutz Prechelt. Early Stopping - but when? In Genevieve B. Orr and Klaus-Robert Müller: Neural Networks: Tricks of the Trade, volume 1524 of LNCS, Springer, 1997.
Definition at line 61 of file GeneralizationLoss.h.
typedef ValidatedSingleObjectiveResultSet<PointType> shark::GeneralizationLoss< PointType >::ResultSet |
Definition at line 63 of file GeneralizationLoss.h.
|
inline |
constructs a generaliazationLoss which stops, when the GL > maxLoss
maxLoss | maximum loss allowed before stopping |
Definition at line 66 of file GeneralizationLoss.h.
References shark::GeneralizationLoss< PointType >::m_maxLoss, and shark::GeneralizationLoss< PointType >::reset().
|
inlinevirtual |
resets the internal state
Implements shark::AbstractStoppingCriterion< ValidatedSingleObjectiveResultSet< PointType > >.
Definition at line 81 of file GeneralizationLoss.h.
References shark::GeneralizationLoss< PointType >::m_minTraining.
Referenced by shark::GeneralizationLoss< PointType >::GeneralizationLoss().
|
inlinevirtual |
returns true if the training should stop. The generalization loss orders the optimizer to stop as soon as the validation error grows larger than a certain factor of the minimum validation error encountered so far.
Implements shark::AbstractStoppingCriterion< ValidatedSingleObjectiveResultSet< PointType > >.
Definition at line 74 of file GeneralizationLoss.h.
References shark::GeneralizationLoss< PointType >::m_minTraining.
|
inline |
returns the current generalization loss
Definition at line 85 of file GeneralizationLoss.h.
References shark::GeneralizationLoss< PointType >::m_gl.
|
protected |
current generalization loss
Definition at line 97 of file GeneralizationLoss.h.
Referenced by shark::GeneralizationLoss< PointType >::value().
|
protected |
maximum loss allowed
Definition at line 95 of file GeneralizationLoss.h.
Referenced by shark::GeneralizationLoss< PointType >::GeneralizationLoss().
|
protected |
minimum training error
Definition at line 90 of file GeneralizationLoss.h.
Referenced by shark::GeneralizationLoss< PointType >::reset(), and shark::GeneralizationLoss< PointType >::stop().
|
protected |
minimum validation error
Definition at line 92 of file GeneralizationLoss.h.