# helia_edge.plotting.history

## Training History Plotting API

This module provides utility functions to plot training history metrics.

**Functions**

| Name | Description |
| --- | --- |
| `plot_history_metrics` | Plot training history metrics |

## helia_edge.plotting.history.plot_history_metrics

`function` · `python`

```python
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:
```python

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**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| history | dict[str, list[float]] | Required | Training history |
| metrics | list[str] | Required | Metrics to plot |
| save_path | Path \| None | None | Path to save plot. Defaults to None. |
| include_val | bool | True | Include validation metrics. Defaults to True. |
| figsize | tuple[int, int] | (9, 5) | Figure size. Defaults to (9, 5). |
| colors | tuple[str \| tuple[str, str]] | ('blue', 'orange') | Colors for train and val. Defaults to ("blue", "orange"). |
| stack | bool | False | Stack metrics. Defaults to False. |
| title | str \| None | None | Title for plot. Defaults |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | tuple[plt.Figure, plt.Axes] | tuple[plt.Figure, plt.Axes]: Figure and axes handles |

Source: `helia_edge/plotting/history.py:19`
