Heatmap / HeatmapDelta / HeatmapSeries
Fetched via Result.get_heatmap and ResultSeries.heatmaps. See the Heatmap Visualization guide for usage.
ml_debugger.visualization.schemas.Heatmap
Bases: BaseModel
Heatmap aggregated for a single dataset_type.
Returned by :meth:Result.get_heatmap. Visualize it with :meth:show
(renders + displays), :meth:to_figure (Figure only), or :meth:save.
Subtract two heatmaps (hm_a - hm_b) to obtain a :class:HeatmapDelta.
OOD bins are derived from the delta's per-bin a_count / b_count
fields (no dedicated method).
show(mode='count', cmap=None, color_scale='auto', figsize=(8, 8))
Render the heatmap, display it (plt.show()) and return the Figure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Literal['count', 'error_ratio']
|
Which field to color by. |
'count'
|
|
Optional[str]
|
Matplotlib colormap name. |
None
|
|
Literal['auto', 'unit']
|
|
'auto'
|
|
Tuple[float, float]
|
|
(8, 8)
|
to_figure(mode='count', cmap=None, color_scale='auto', figsize=(8, 8))
Build a matplotlib Figure for this heatmap without displaying it.
The caller owns the returned figure (it is not closed here). See
:meth:show for argument semantics.
save(path, mode='count', cmap=None, color_scale='auto', figsize=(8, 8))
Render the heatmap and save it to path; return the saved path.
ml_debugger.visualization.schemas.HeatmapDelta
Bases: BaseModel
Element-wise difference of two :class:Heatmap.
Each bin retains a_count / b_count so OOD analysis can be done
by inspecting bins (e.g. a_count > 0 and b_count == 0) without a
dedicated method.
show(field='delta_count', cmap='RdBu_r', figsize=(8, 8))
Render the delta, display it (plt.show()) and return the Figure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Literal['delta_count', 'delta_count_ratio', 'delta_error_ratio', 'a_count', 'b_count']
|
Which per-bin scalar to color by. Defaults to
|
'delta_count'
|
|
str
|
Matplotlib colormap name. Diverging (default |
'RdBu_r'
|
|
Tuple[float, float]
|
|
(8, 8)
|
to_figure(field='delta_count', cmap='RdBu_r', figsize=(8, 8))
Build a matplotlib Figure for this delta without displaying it.
The caller owns the returned figure (it is not closed here). See
:meth:show for argument semantics.
save(path, field='delta_count', cmap='RdBu_r', figsize=(8, 8))
Render the delta and save it to path; return the saved path.
ml_debugger.visualization.schemas.HeatmapSeries
Bases: BaseModel
An ordered time-series of :class:Heatmap objects (one per epoch).
Returned by ResultSeries.heatmaps(...). epochs and heatmaps are
index-aligned: heatmaps[i] was evaluated at epochs[i] (an epoch may
be None for a result that carries no epoch). Construct it as
HeatmapSeries(epochs=[...], heatmaps=[...]).
Visualize the absolute series with :meth:show (a filmstrip: one subplot
per epoch). Inspect consecutive change with :meth:deltas (data) or
:meth:show_deltas (filmstrip). Delta methods reuse :meth:Heatmap.__sub__
and therefore raise ValueError when adjacent epochs have differing axis
ranges / bins / aggregation_level (the message hints at common-axis needs).
show(mode='count', ncols=4, cmap=None, color_scale='auto', figsize_per=(4, 4))
Render a filmstrip (one subplot per epoch), display it, return the Figure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Literal['count', 'error_ratio']
|
Which field to color by. |
'count'
|
|
int
|
Number of columns in the subplot grid. |
4
|
|
Optional[str]
|
Matplotlib colormap name. |
None
|
|
Literal['auto', 'unit']
|
|
'auto'
|
|
Tuple[float, float]
|
|
(4, 4)
|
show_deltas(field='delta_count', ncols=4, cmap='RdBu_r', figsize_per=(4, 4))
Render a filmstrip of consecutive deltas, display it, return the Figure.
Each subplot i shows heatmaps[i] - heatmaps[i-1] labelled
epoch[i-1]->epoch[i].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Literal['delta_count', 'delta_count_ratio', 'delta_error_ratio', 'a_count', 'b_count']
|
Which per-bin scalar to color by. Defaults to
|
'delta_count'
|
|
int
|
Number of columns in the subplot grid. |
4
|
|
str
|
Matplotlib colormap name. Diverging (default |
'RdBu_r'
|
|
Tuple[float, float]
|
|
(4, 4)
|
Raises:
| Type | Description |
|---|---|
ValueError
|
on axis mismatch between adjacent epochs (see
:meth: |
deltas()
Consecutive deltas heatmaps[i] - heatmaps[i-1] (time order).
Reuses :meth:Heatmap.__sub__. Returns len(self) - 1 deltas (empty
when the series has fewer than two heatmaps).
Raises:
| Type | Description |
|---|---|
ValueError
|
when adjacent epochs have incompatible axes / ranges /
n_bins / aggregation_level. The message from
|