BaseCallback#
- class pyqit.core.callbacks.BaseCallback[source]#
Bases:
_PyQitObjectBase class for pyqit callbacks.
Override any of the three hooks. Each takes one LoopState, and both training loops call them, so a subclass works on either backend.
Examples
>>> from pyqit.core import BaseCallback >>> class StopWhenConverged(BaseCallback): ... def on_epoch_end(self, state): ... if state.metrics["train_loss"] < 0.01: ... state.stop = True
- classmethod get_test_params()[source]#
List constructor kwargs used to parametrize this class in the test suite.
- on_epoch_end(state: LoopState) None[source]#
Called once per epoch, with
state.metricsfilled for that epoch.