ikkuna.visualization

Module contents

class ikkuna.visualization.TBBackend(**kwargs)[source]

Bases: ikkuna.visualization.backend.Backend

Tensorboard backend.

Note

Whitespace and punctuation in the title will be replaced with underscores due to the fact that it becomes part of a file name.

_writer
Type:tensorboardX.SummaryWriter
_hist_bins

Number of bins to use for histograms

Type:int
info = 'n/a'
add_data(module_name, datum, step)[source]

Display scalar data (i.e. a line plot)

Parameters:
  • module_name (str) – Name of module which emitted the data
  • datum (torch.Tensor) – Payload
  • step (int) – Global step
add_histogram(module_name, datum, step, bins='auto')[source]

Display histogram data (i.e. a line plot)

Parameters:
  • module_name (str) – Name of module which emitted the data
  • datum (torch.Tensor) – Payload, not the histogram itself
  • step (int) – Global step
class ikkuna.visualization.MPLBackend(**kwargs)[source]

Bases: ikkuna.visualization.backend.Backend

Matplotlib backend (use in Jupyter with %matplotlib inline or via X-forwarding over ssh [barely useable])

_xlabel

X axis label for line plots

Type:str
_ylabel

Y axis label for line plots

Type:str
_ylims

Limits of the y axis for line plots

Type:tuple
_redraw_counter

Number of datapoints to consume before redrawing the figure

Type:int
_plots

module-plot mapping

Type:dict
_axes

module-UpdatableHistogram mapping (this should be refactored)

Type:dict
_buffer

Per-module buffer of tensors for more reliable histograms

Type:dict
_buffer_lim

Size of the buffer

Type:int
__init__(**kwargs)[source]
Parameters:
  • xlabel (str) –
  • ylabel (str) –
  • ylims (tuple) –
  • buffer_lim (int) – Buffer size for more reliable histograms
_prepare_axis(ax)[source]

Prepare the line plot axis with labels and scaling.

title
xlabel
ylabel
_reflow_plots()[source]

Reqorganize the histogram subplots into a rectangular shape. For now, the sublots are arranged on a grid twice as high as it is wide, since vertical space is often in abundance.

Note

This does not recompute the plots

add_histogram(module_name, datum, step)[source]

Display histogram data (i.e. a line plot)

Parameters:
  • module_name (str) – Name of module which emitted the data
  • datum (torch.Tensor) – Payload, not the histogram itself
  • step (int) – Global step
add_data(module_name, datum, step)[source]

Display scalar data (i.e. a line plot)

Parameters:
  • module_name (str) – Name of module which emitted the data
  • datum (torch.Tensor) – Payload
  • step (int) – Global step
class ikkuna.visualization.Backend(title)[source]

Bases: abc.ABC

Base class for visualiation backends. Subscribers use this class to dispatch their metrics to have them visualised.

title

The figure title

Type:str
__init__(title)[source]
Parameters:title (str) – Title to use for the figure.
add_data(module_name, datum, step)[source]

Display scalar data (i.e. a line plot)

Parameters:
  • module_name (str) – Name of module which emitted the data
  • datum (torch.Tensor) – Payload
  • step (int) – Global step
add_histogram(module_name, datum, step)[source]

Display histogram data (i.e. a line plot)

Parameters:
  • module_name (str) – Name of module which emitted the data
  • datum (torch.Tensor) – Payload, not the histogram itself
  • step (int) – Global step
title
ikkuna.visualization.configure_prefix(p)[source]

Set a prefix to the log directory for Tensorboard.

Parameters:p (str) – Prefix to the directory name. _runs will be appended by TBBackend
class ikkuna.visualization.NullBackend(*args, **kwargs)[source]

Bases: ikkuna.visualization.backend.Backend

add_data(*args, **kwargs)[source]

Display scalar data (i.e. a line plot)

Parameters:
  • module_name (str) – Name of module which emitted the data
  • datum (torch.Tensor) – Payload
  • step (int) – Global step
add_histogram(*args, **kwargs)[source]

Display histogram data (i.e. a line plot)

Parameters:
  • module_name (str) – Name of module which emitted the data
  • datum (torch.Tensor) – Payload, not the histogram itself
  • step (int) – Global step
title()[source]