# helia_edge.plotting.cm

## Confusion Matrix Plotting API

This module provides utility functions to plot confusion matrices.

**Functions**

| Name | Description |
| --- | --- |
| `multilabel_confusion_matrix_plot` | Generate multilabel confusion matrix plot via matplotlib/seaborn |
| `confusion_matrix_plot` | Generate confusion matrix plot via matplotlib/seaborn |
| `px_plot_confusion_matrix` | Generate confusion matrix plot via plotly |

## helia_edge.plotting.cm.multilabel_confusion_matrix_plot

`function` · `python`

```python
multilabel_confusion_matrix_plot(
    y_true: npt.NDArray,
    y_pred: npt.NDArray,
    labels: list[str],
    save_path: os.PathLike | None = None,
    normalize: Literal['true', 'pred', 'all'] | None = False,
    max_cols: int = 5,
    **kwargs={},
) -> tuple[plt.Figure, plt.Axes] | None
```

Generate multilabel confusion matrix plot via matplotlib/seaborn

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| y_true | npt.NDArray | Required | True y labels |
| y_pred | npt.NDArray | Required | Predicted y labels |
| labels | list[str] | Required | Label names |
| save_path | str \| None | None | Path to save plot. Defaults to None. |
| normalize | Literal['true', 'pred', 'all'] \| None | False | Normalize. Defaults to False. |
| max_cols | int | 5 | Max columns. Defaults to 5. |

**Returns**

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

Source: `helia_edge/plotting/cm.py:30`

## helia_edge.plotting.cm.confusion_matrix_plot

`function` · `python`

```python
confusion_matrix_plot(
    y_true: npt.NDArray,
    y_pred: npt.NDArray,
    labels: list[str],
    save_path: os.PathLike | None = None,
    normalize: Literal['true', 'pred', 'all'] | None = False,
    **kwargs={},
) -> tuple[plt.Figure, plt.Axes] | None
```

Generate confusion matrix plot via matplotlib/seaborn

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| y_true | npt.NDArray | Required | True y labels |
| y_pred | npt.NDArray | Required | Predicted y labels |
| labels | list[str] | Required | Label names |
| save_path | str \| None | None | Path to save plot. Defaults to None. |

**Returns**

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

Source: `helia_edge/plotting/cm.py:99`

## helia_edge.plotting.cm.px_plot_confusion_matrix

`function` · `python`

```python
px_plot_confusion_matrix(
    y_true: npt.NDArray,
    y_pred: npt.NDArray,
    labels: list[str],
    normalize: Literal['true', 'pred', 'all'] | None = False,
    save_path: os.PathLike | None = None,
    title: str | None = None,
    width: int | None = None,
    height: int | None = 400,
    bg_color: str = 'rgba(38,42,50,1.0)',
) -> go.Figure
```

Generate confusion matrix plot via plotly

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| y_true | npt.NDArray | Required | True y labels |
| y_pred | npt.NDArray | Required | Predicted y labels |
| labels | list[str] | Required | Label names |
| normalize | Literal['true', 'pred', 'all'] \| None | False | Normalize. Defaults to False. |
| save_path | os.PathLike \| None | None | Path to save plot. Defaults to None. |
| title | str \| None | None | Title. Defaults to None. |
| width | int \| None | None | Width. Defaults to None. |
| height | int \| None | 400 | Height. Defaults to 400. |
| bg_color | str | 'rgba(38,42,50,1.0)' | Background color. Defaults to "rgba(38,42,50,1.0)". |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | go.Figure | go.Figure: Plotly figure |

Source: `helia_edge/plotting/cm.py:140`
