sconce.monitors package — Pytorch-Sconce master documentation

# sconce.monitors package

## sconce.monitors.base module

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

  Bases: `sconce.monitors.base.Monitor`

  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', 'validation_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.

  `add_monitor`(other)
  `end_session`(**kwargs)
  `start_session`(num_steps, **kwargs)
  `write`(data, step, **kwargs)

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

  Bases: `abc.ABC`

  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’, ‘validation_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.

## sconce.monitors.dataframe_monitor module

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

  Bases: `sconce.monitors.base.Monitor`

  `df`
  classmethod `from_file`(filename, key)
  `is_blacklisted`(key)
  `plot`(title='Training History', figsize=(15, 5), skip_first=100, smooth_window=50, metrics=['loss'], hyperparameters=['learning_rate'], test_color=None, validation_color='tomato', training_color='mediumseagreen', fig=None)
  `plot_learning_rate_survey`(ax=None, figure_kwargs={}, **plot_kwargs)
  `save`(filename, key)
  `start_session`(num_steps, **kwargs)
  `write`(data, step, **kwargs)

## sconce.monitors.losswise_monitor module

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

  Bases: `sconce.monitors.base.Monitor`

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

## sconce.monitors.ringbuffer_monitor module

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

  Bases: `sconce.monitors.base.Monitor`

  `mean`(*args, **kwargs)
  `movement_index`
  `start_session`(num_steps, **kwargs)
  `std`(*args, **kwargs)
  `write`(data, step, **kwargs)

## sconce.monitors.stdout_monitor module

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

  Bases: `sconce.monitors.base.Monitor`

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