NeuralNet 1.0
Loading...
Searching...
No Matches
NeuralNet::EarlyStopping Class Reference
Inheritance diagram for NeuralNet::EarlyStopping:
NeuralNet::Callback

Public Member Functions

 EarlyStopping (const std::string &metric="LOSS", double minDelta=0, int patience=0)
 EarlyStopping is a Callback that stops training when a monitored metric has stopped improving.
 
void onEpochBegin (Model &model) override
 
void onEpochEnd (Model &model) override
 This method will be called at the end of each epoch.
 
void onTrainBegin (Model &model) override
 
void onTrainEnd (Model &model) override
 
void onBatchBegin (Model &model) override
 
void onBatchEnd (Model &model) override
 

Additional Inherited Members

- Static Public Member Functions inherited from NeuralNet::Callback
template<typename T >
static void callMethod (std::shared_ptr< T > callback, const std::string &methodName, Model &model)
 Calls the method of the callback with the given logs.
 
- Static Protected Member Functions inherited from NeuralNet::Callback
static void checkMetric (const std::string &metric, const std::vector< std::string > &metrics)
 
static std::unordered_map< std::string, Logs > getLogs (Model &model)
 

Constructor & Destructor Documentation

◆ EarlyStopping()

NeuralNet::EarlyStopping::EarlyStopping ( const std::string & metric = "LOSS",
double minDelta = 0,
int patience = 0 )
inline

EarlyStopping is a Callback that stops training when a monitored metric has stopped improving.

Parameters
metricThe metric to monitor (default: LOSS)
minDeltaMinimum change in the monitored quantity to qualify as an improvement, i.e. an absolute change of less than minDelta, will count as no improvement. (default: 0)
patienceNumber of epochs with no improvement after which training will be stopped. (default: 0)

Member Function Documentation

◆ onBatchBegin()

void NeuralNet::EarlyStopping::onBatchBegin ( Model & model)
inlineoverridevirtual

Implements NeuralNet::Callback.

◆ onBatchEnd()

void NeuralNet::EarlyStopping::onBatchEnd ( Model & model)
inlineoverridevirtual

Implements NeuralNet::Callback.

◆ onEpochBegin()

void NeuralNet::EarlyStopping::onEpochBegin ( Model & model)
inlineoverridevirtual

Implements NeuralNet::Callback.

◆ onEpochEnd()

void NeuralNet::EarlyStopping::onEpochEnd ( Model & model)
inlineoverridevirtual

This method will be called at the end of each epoch.

Parameters
epochThe current epoch
logsThe logs of the current epoch
Returns
Returns true if the training should continue otherwise returns false
Warning
The order of the logs should be the same as the order of the metrics.

Implements NeuralNet::Callback.

◆ onTrainBegin()

void NeuralNet::EarlyStopping::onTrainBegin ( Model & model)
inlineoverridevirtual

Implements NeuralNet::Callback.

◆ onTrainEnd()

void NeuralNet::EarlyStopping::onTrainEnd ( Model & model)
inlineoverridevirtual

Implements NeuralNet::Callback.


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