ksuit.callbacks.early_stoppers.early_stopper_base

Exceptions

EarlyStopIteration

Custom StopIteration exception for Early Stoppers.

Classes

EarlyStopperBase

Base class for early stoppers that is used to define the interface for early stoppers used by ksuit trainers.

Module Contents

exception ksuit.callbacks.early_stoppers.early_stopper_base.EarlyStopIteration

Bases: StopIteration

Custom StopIteration exception for Early Stoppers.

Initialize self. See help(type(self)) for accurate signature.

class ksuit.callbacks.early_stoppers.early_stopper_base.EarlyStopperBase(callback_config, trainer, model, data_container, tracker, log_writer, checkpoint_writer, metric_property_provider, name=None)

Bases: ksuit.callbacks.base.PeriodicCallback

Base class for early stoppers that is used to define the interface for early stoppers used by ksuit trainers.

Initializes the PeriodicCallback.

Parameters:
  • callback_config (ksuit.schemas.callbacks.callbacks_config.CallBackBaseConfig) – Configuration of the PeriodicCallback. Implements the CallBackBaseConfig schema.

  • trainer (ksuit.trainers.BaseTrainer) – Trainer of the current run, subclass of SgdTrainer.

  • model (ksuit.models.model_base.ModelBase) – Model of the current run.

  • data_container (ksuit.utils.data.data_container.DataContainer) – DataContainer instance that provides access to all datasets.

  • tracker (ksuit.trackers.BaseTracker) – Tracker instance to log metrics to stdout/disk/online platform.

  • log_writer (ksuit.writers.LogWriter) – LogWriter instance to log metrics.

  • checkpoint_writer (ksuit.writers.CheckpointWriter) – CheckpointWriter instance to save checkpoints.

  • metric_property_provider (ksuit.providers.metric_property_provider.MetricPropertyProvider) – MetricPropertyProvider instance 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:

str