samlab.interactive module

Utilities to simplify user interaction during experiments.

class samlab.interactive.Progress(desc=None, unit=None)[source]

Bases: object

Display a graphical progress bar while iterating over a sequence.

class samlab.interactive.Stop(timeout=5.0)[source]

Bases: object

Handle interrupts so training can be interrupted gracefully.

Create an instance of samlab.interactive.Stop and check its triggered property periodically during training. If triggered is True then the user has interrupted the process, either with CTRL-C or the Jupyter Interrupt Kernel button.

trigger()[source]

Programmatically trigger an interruption.

property triggered

True if the user has interrupted the process, False otherwise.