noether.core.callbacks.early_stoppers.metric

Classes

MetricEarlyStopperConfig

Internal base class for all registry-based configs.

MetricEarlyStopper

Early stopper (training) based on a metric value to be monitored.

Module Contents

class noether.core.callbacks.early_stoppers.metric.MetricEarlyStopperConfig(/, **data)

Bases: noether.core.callbacks.base.CallBackBaseConfig

Internal base class for all registry-based configs.

Provides auto-registration via __init_subclass__. Not meant to be used directly - use specific config base classes instead.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

name: Literal['MetricEarlyStopper'] = None
metric_key: str

The key of the metric to monitor

tolerance: int

The number of times the metric can stagnate before stopping training

classmethod check_tolerance_positive(v)

Ensures that tolerance is at least 1.

Parameters:

v (int)

Return type:

int

class noether.core.callbacks.early_stoppers.metric.MetricEarlyStopper(callback_config, **kwargs)

Bases: noether.core.callbacks.early_stoppers.base.EarlyStopperBase

Early stopper (training) based on a metric value to be monitored.

Example config:

- kind: noether.core.callbacks.MetricEarlyStopper
  every_n_epochs: 1
  metric_key: loss/val/total
  tolerance: 0.10
  name: MetricEarlyStopper
Parameters:
  • callback_config (MetricEarlyStopperConfig) – Configuration for the callback. See MetricEarlyStopperConfig for available options including metric key and tolerance.

  • **kwargs – Additional arguments to pass to the parent class.

metric_key
higher_is_better
tolerance
tolerance_counter = 0
best_metric