Skip to content
heliaEDGE
Reference
HELIA

history

This module provides utility functions to plot training history metrics.

Functions

Name Description
plot_history_metrics Plot training history metrics

Machine-readable model

function

Plot training history metrics returned by model.fit.

helia_edge/plotting/history.py:19

plot_history_metrics(
history: dict[str, list[float]],
metrics: list[str],
save_path: Path | None = None,
include_val: bool = True,
figsize: tuple[int, int] = (9, 5),
colors: tuple[str | tuple[str, str]] = ('blue', 'orange'),
stack: bool = False,
title: str | None = None,
**kwargs={},
) -> tuple[plt.Figure, plt.Axes]

Plot training history metrics returned by model.fit.

Example:

history = dict(
loss=[0.1, 0.2, 0.3, 0.4],
accuracy=[0.9, 0.8, 0.7, 0.6],
val_loss=[0.1, 0.2, 0.3, 0.4],
val_accuracy=[0.9, 0.8, 0.7, 0.6],
)
import helia_edge as helia
fig, ax = helia.plotting.plot_history_metrics(
history,
metrics=["loss", "accuracy"],
include_val=True,
stack=False,
)
Parameters of plot_history_metrics
NameTypeDefaultDescription
historydict[str, list[float]]RequiredTraining history
metricslist[str]RequiredMetrics to plot
save_pathPath | NoneNonePath to save plot. Defaults to None.
include_valboolTrueInclude validation metrics. Defaults to True.
figsizetuple[int, int](9, 5)Figure size. Defaults to (9, 5).
colorstuple[str | tuple[str, str]]('blue', 'orange')Colors for train and val. Defaults to ("blue", "orange").
stackboolFalseStack metrics. Defaults to False.
titlestr | NoneNoneTitle for plot. Defaults
Returns of plot_history_metrics
TypeDescription
tuple[plt.Figure, plt.Axes]tuple[plt.Figure, plt.Axes]: Figure and axes handles