Monitors — Pytorch-Sconce master documentation

# Monitors

## Monitor

class `sconce.monitors.` `Monitor`(name)

  Base class for monitors in sconce. A monitor is an object that a `Trainer` uses to record metrics during training or other tasks. This base class defines the interface that trainers use. Monitors can be composed together (using addition operator) to produce a `CompositeMonitor` object.

  Parameters: | name (str) – used to gain access to a monitor when it has been composed together into a `CompositeMonitor`.

  `end_session`(**kwargs)

    Called by a `Trainer` when a training/evaluation session has ended.

    Parameters: | **kwargs – must be accepted to allow for future use cases.

  `start_session`(num_steps, **kwargs)

    Called by a `Trainer` when starting a training/evaluation session.

    Parameters: | num_steps (int) – [1, inf) the number of update/evaluation steps to expect. **kwargs – must be accepted to allow for future use cases.

  `write`(data, step, **kwargs)

    Called by a `Trainer` during a training/evaluation session just after the training/evaluation step.

    Parameters: | data (dict) – the output of the training/evaluation step. The keys may include, but are not limited to: {‘training_loss’, ‘test_loss’, ‘learning_rate’}. step (float) – (0.0, inf) the step that was just completed. Fractional steps are possible (see batch_multiplier option on `sconce.trainer.Trainer.train()`). **kwargs – must be accepted to allow for future use cases.

## CompositeMonitor

class `sconce.monitors.` `CompositeMonitor`(monitors)

  A monitor composed of two or more monitors. Using this allows you to pass a single monitor object to a trainer method and have it use all of the composed monitors. Composed monitors can be accessed using their name like so:

      >>> from sconce import monitors
      >>> metric_names = {'training_loss': 'loss', 'test_loss': 'val_loss'}
      >>> stdout_monitor = monitors.StdoutMonitor(metric_names=metric_names)
      >>> dataframe_monitor = monitors.DataframeMonitor()
      >>> monitor = dataframe_monitor + stdout_monitor
      >>> monitor.dataframe_monitor
      <sconce.monitors.dataframe_monitor.DataframeMonitor at 0x7fb1fbd498d0>
      >>> dataframe_monitor is monitor.dataframe_monitor
      True

  Parameters: | monitors (iterable of `Monitor`) – the monitors you want to compose together.

## DataframeMonitor

class `sconce.monitors.` `DataframeMonitor`(df=None, metadata=None, blacklist=['._inputs', '._outputs', '._targets'], name='dataframe_monitor')

## LosswiseMonitor

class `sconce.monitors.` `LosswiseMonitor`(api_key, tag, params={}, min_graphs={'loss': {'training_loss': 'Training Loss', 'test_loss': 'Test Loss'}, 'lr': {'learning_rate': 'Learning Rate'}}, max_graphs={}, name='losswise_monitor')

## RingbufferMonitor

class `sconce.monitors.` `RingbufferMonitor`(capacity=100, key='training_loss', name='ringbuffer_monitor')

## StdoutMonitor

class `sconce.monitors.` `StdoutMonitor`(metric_names, progbar_kwargs={}, name='stdout_monitor')