hosa.callbacks.early_stopping.EarlyStoppingAtMinLoss

class hosa.callbacks.early_stopping.EarlyStoppingAtMinLoss(class_model, patience, validation_data, imbalance_correction=False, rtol=0.001, atol=0.0001)[source]

Bases: keras.callbacks.Callback

This class implements the early stopping for avoiding overfitting the model. The training is stopped when the monitored metric has stopped improving.

Parameters
  • class_model – Class of the object to be optimized. Available options are: RNNClassification, RNNRegression, CNNClassification and CNNRegression.

  • patience (int) – Number of epochs with no improvement after which training will be stopped.

  • validation_data (numpy.ndarray) – Input data extracted from the validation dataset ( which was itself extracted from the training dataset).

  • imbalance_correction (bool) – True if correction for imbalance should be applied to the metrics; False otherwise.

  • rtol (float) – The relative tolerance parameter, as used in numpy.isclose. See numpy.isclose.

  • atol (float) –

    The absolute tolerance parameter, as used in numpy.isclose. See numpy.isclose.

Methods

on_batch_begin(batch[, logs])

A backwards compatibility alias for on_train_batch_begin.

on_batch_end(batch[, logs])

A backwards compatibility alias for on_train_batch_end.

on_epoch_begin(epoch[, logs])

Called at the start of an epoch.

on_epoch_end(epoch[, logs])

Checks, based on the patience value, if the training should stop.

on_predict_batch_begin(batch[, logs])

Called at the beginning of a batch in predict methods.

on_predict_batch_end(batch[, logs])

Called at the end of a batch in predict methods.

on_predict_begin([logs])

Called at the beginning of prediction.

on_predict_end([logs])

Called at the end of prediction.

on_test_batch_begin(batch[, logs])

Called at the beginning of a batch in evaluate methods.

on_test_batch_end(batch[, logs])

Called at the end of a batch in evaluate methods.

on_test_begin([logs])

Called at the beginning of evaluation or validation.

on_test_end([logs])

Called at the end of evaluation or validation.

on_train_batch_begin(batch[, logs])

Called at the beginning of a training batch in fit methods.

on_train_batch_end(batch[, logs])

Called at the end of a training batch in fit methods.

on_train_begin([logs])

Called at the beginning of training to initialize the variables for early stopping.

on_train_end([logs])

This function is called when the training is finished, and it is used to set a flag for early stopping.

set_model(model)

set_params(params)