scvi.train.SaveBestState#

class scvi.train.SaveBestState(monitor='elbo_validation', mode='min', verbose=False, period=1)[source]#

Bases: Callback

Save the best module state and restore into model.

Parameters:
  • monitor (str (default: 'elbo_validation')) – quantity to monitor.

  • verbose (default: False) – verbosity, True or False.

  • mode (str (default: 'min')) – one of [“min”, “max”].

  • period (default: 1) – Interval (number of epochs) between checkpoints.

Examples

from scvi.train import Trainer from scvi.train import SaveBestState

Attributes table#

Methods table#

check_monitor_top(current)

on_train_end(trainer, pl_module)

Called when the train ends.

on_train_start(trainer, pl_module)

Called when the train begins.

on_validation_epoch_end(trainer, pl_module)

Called when the val epoch ends.

Attributes#

Methods#

SaveBestState.check_monitor_top(current)[source]#
SaveBestState.on_train_end(trainer, pl_module)[source]#

Called when the train ends.

SaveBestState.on_train_start(trainer, pl_module)[source]#

Called when the train begins.

SaveBestState.on_validation_epoch_end(trainer, pl_module)[source]#

Called when the val epoch ends.