xlnstorch.viz.plot_error_heatmap

xlnstorch.viz.plot_error_heatmap#

xlnstorch.viz.plot_error_heatmap(err, xs, ys=None, *, ax=None, cmap='viridis', vmin=None, vmax=None)#

Visualise the error tensor returned by make_error_grid. Unary errors are drawn as a coloured stripe; binary errors as a 2-D map.

Parameters:
  • err (torch.Tensor) – The error tensor, typically returned by make_error_grid.

  • xs (torch.Tensor) – The x values corresponding to the error tensor.

  • ys (torch.Tensor, optional) – The y values corresponding to the error tensor. If None, a unary operation is assumed and the error is visualised as a single horizontal stripe.

  • ax (matplotlib.axes.Axes, optional) – The axes on which to plot the heatmap. If None, a new figure and axes will be created.

  • cmap (str, optional) – The colormap to use for the heatmap. Default is “viridis”.

  • vmin (float, optional) – The minimum value for the colormap. If None, it will be set to the minimum value of the error tensor.

  • vmax (float, optional) – The maximum value for the colormap. If None, it will be set to the maximum value of the error tensor.

Returns:

The axes containing the heatmap.

Return type:

matplotlib.axes.Axes

Raises:

ImportError – If matplotlib is not installed, an ImportError is raised.