noether.core.callbacks.early_stoppers.base¶
Exceptions¶
Custom StopIteration exception for Early Stoppers. |
Classes¶
Base class for early stoppers that is used to define the interface for early stoppers used by the trainers. |
Module Contents¶
- exception noether.core.callbacks.early_stoppers.base.EarlyStopIteration¶
Bases:
StopIterationCustom StopIteration exception for Early Stoppers.
Initialize self. See help(type(self)) for accurate signature.
- class noether.core.callbacks.early_stoppers.base.EarlyStopperBase(callback_config, trainer, model, data_container, tracker, log_writer, checkpoint_writer, metric_property_provider, name=None)¶
Bases:
noether.core.callbacks.periodic.PeriodicCallbackBase class for early stoppers that is used to define the interface for early stoppers used by the trainers.
- Parameters:
callback_config (noether.core.schemas.callbacks.CallBackBaseConfig) – Configuration for the callback. See
CallBackBaseConfigfor available options.trainer (noether.training.trainers.BaseTrainer) – Trainer of the current run.
model (noether.core.models.ModelBase) – Model of the current run.
data_container (noether.data.container.DataContainer) –
DataContainerinstance that provides access to all datasets.tracker (noether.core.trackers.BaseTracker) –
BaseTrackerinstance to log metrics to stdout/disk/online platform.log_writer (noether.core.writers.LogWriter) –
LogWriterinstance to log metrics.checkpoint_writer (noether.core.writers.CheckpointWriter) –
CheckpointWriterinstance to save checkpoints.metric_property_provider (noether.core.providers.MetricPropertyProvider) –
MetricPropertyProviderinstance to access properties of metrics.name (str | None) – Name of the callback.
- to_short_interval_string()¶
Convert the interval to a short string representation used for logging.
- Return type:
- periodic_callback(*, interval_type, update_counter, **kwargs)¶
Check if training should stop and raise exception if needed.
- Parameters:
interval_type (noether.core.callbacks.periodic.IntervalType) – Type of interval that triggered this callback.
update_counter (noether.core.utils.training.UpdateCounter) –
UpdateCounterinstance with current training state.**kwargs – Additional keyword arguments.
- Raises:
EarlyStopIteration – If training should be stopped based on the stopping criterion.
- Return type:
None