1 #ifndef _ITERATIVEMETHODHANDLER_H_
2 #define _ITERATIVEMETHODHANDLER_H_
22 template <
typename IT,
typename ET>
27 friend class boost::serialization::access;
34 template <
typename Archive>
35 void serialize(Archive &ar,
unsigned int const version){
71 PATIENCE_EARLY_STOPPING,
309 #include <IterativeMethodHandler.tpp>
Base implementation of an iterative method.
Definition: IterativeMethodHandler.h:23
size_t patience
How many consecutive iterations with no improvement will be tolerated until aborting.
Definition: IterativeMethodHandler.h:115
virtual void setMaxIters(size_t const maxIters)
Set the maximum number of iterations.
Definition: IterativeMethodHandler.h:202
virtual IT getPatienceBestInput() const
Obtain the input of best known case for patience based early stopping mechanism.
Definition: IterativeMethodHandler.h:293
size_t patienceCount
Count of how many consecutive iterations without improvement have elapsed.
Definition: IterativeMethodHandler.h:120
virtual void setPatienceCount(size_t const count)
Set the number of consecutive iterations without improvement.
Definition: IterativeMethodHandler.h:241
virtual size_t getMaxIters() const
Obtain the maximum number of iterations.
Definition: IterativeMethodHandler.h:196
virtual size_t getCurrentIter() const
Obtain the number of current iteration.
Definition: IterativeMethodHandler.h:209
void serialize(Archive &ar, unsigned int const version)
Serialize the iterative method handler to a stream of bytes.
Definition: IterativeMethodHandler.h:35
IterativeMethodStatus
Enumeration with different iterative method status.
Definition: IterativeMethodHandler.h:70
virtual void setPatiencePreserveBest(bool const preserveBest)
Set the patience based early stopping mechanism preserve best mode.
Definition: IterativeMethodHandler.h:271
virtual bool isPatiencePreservingBest() const
Check whether the patience based early stopping mechanism is preserving best (true) or not (false)
Definition: IterativeMethodHandler.h:262
size_t currentIter
The current iteration of the iterative method.
Definition: IterativeMethodHandler.h:92
virtual IterativeMethodStatus handleEndOfIteration(IT const &input, ET const &error)
Handle end of iteration.
virtual size_t getPatienceCount() const
Obtain number of consecutive iterations without improvement.
Definition: IterativeMethodHandler.h:235
ET convergenceEps
The convergence threshold .
Definition: IterativeMethodHandler.h:104
bool patiencePreserveBest
True to enable preserving best known input when early stopping because of patience,...
Definition: IterativeMethodHandler.h:134
IT patienceBestInput
Input of best known case for patience based early stopping mechanism.
Definition: IterativeMethodHandler.h:144
virtual void setPatience(size_t const patience)
Set the patience of the iterative method.
Definition: IterativeMethodHandler.h:228
IterativeMethodHandler(size_t maxIters, bool enableConvergenceCriterion=false, ET convergenceEps=0.000000001, size_t patience=0, ET patienceEps=0.000000001, bool patiencePreserveBest=true)
Iterative method constructor.
Definition: IterativeMethodHandler.h:156
virtual ET getPatienceBestError() const
Get the patience based early stopping mechanism best known error.
Definition: IterativeMethodHandler.h:278
virtual void setPatienceBestError(ET bestError)
Set the patience based early stopping mechanism best known error.
Definition: IterativeMethodHandler.h:284
ET patienceBestError
Error of best known case for patience based early stopping mechanism.
Definition: IterativeMethodHandler.h:139
virtual void setPatienceEps(ET const eps)
Set the tolerance criterion for patience based early stopping.
Definition: IterativeMethodHandler.h:254
ET patienceEps
The tolerance criterion to determine whether there have been an improvement or not.
Definition: IterativeMethodHandler.h:129
virtual void setPatienceBestInput(IT bestInput)
Set the input of best known case for patience based early stopping mechanism.
Definition: IterativeMethodHandler.h:301
bool enableConvergenceCriterion
True to enable the usage of convergence criterion.
Definition: IterativeMethodHandler.h:96
virtual void setCurrentIter(size_t const iter)
Set the number of current iteration.
Definition: IterativeMethodHandler.h:215
size_t maxIters
Maximum number of iterations for the iterative method.
Definition: IterativeMethodHandler.h:88
virtual ET getPatienceEps() const
Obtain the tolerance criterion for patience based early stopping.
Definition: IterativeMethodHandler.h:248
virtual size_t getPatience() const
Obtain the patience of the iterative method.
Definition: IterativeMethodHandler.h:222