EarlyStopping#
- class pyqit.core.callbacks.EarlyStopping(monitor: str | None = None, patience: int = 5, min_delta: float = 0.0, mode: str = 'min', check_finite: bool = True, verbose: bool = True)[source]#
Bases:
BaseCallbackRequest a stop after
patienceepochs without improvement.- Parameters:
monitor (str, optional) – Metric to watch.
Nonepicks"val_loss"when a validation split produced a finite value and"train_loss"otherwise.patience (int, default 5) – Epochs without improvement to tolerate. Counted the way
lightning.pytorch.callbacks.EarlyStoppingcounts it, so a given value means the same number of epochs in both frameworks.min_delta (float, default 0.0) – Improvement smaller than this does not count as an improvement.
mode ({"min", "max"}, default "min") – Whether a lower or higher value of
monitoris better.check_finite (bool, default True) – Stop as soon as the monitored metric is NaN or infinite. Matters on a quantum model because a diverged circuit yields NaN rather than a large loss, and NaN never trips the patience counter.
verbose (bool, default True) – Announce the stop through the run’s reporter.
- stopped_epoch#
Epoch the stop was requested on, or None if it never was.
- Type:
int or None
- stopping_reason#
Human-readable reason for the stop.
- Type:
str or None
- best_score#
Best value of
monitorseen.- Type:
float
- classmethod get_test_params()#
List constructor kwargs used to parametrize this class in the test suite.
- on_epoch_end(state: LoopState) None[source]#
Update the wait counter and stop the run if patience ran out.