# helia_edge.metrics.threshold

## Thresholding Metrics API

This module provides utility functions to threshold model predictions.

**Functions**

| Name | Description |
| --- | --- |
| `get_predicted_threshold_indices` | Get prediction indices that are above threshold (confidence level) |
| `threshold_predictions` | Get thresholded predictions |

## helia_edge.metrics.threshold.get_predicted_threshold_indices

`function` · `python`

```python
get_predicted_threshold_indices(y_prob: npt.NDArray, y_pred: npt.NDArray, threshold: float = 0.5) -> npt.NDArray
```

Get prediction indices that are above threshold (confidence level).
This is useful to remove weak predictions that can happen due to noisy data or poor model performance.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| y_prob | npt.NDArray | Required | Model output as probabilities |
| y_pred | npt.NDArray | Required | Model predictions. Defaults to None. |
| threshold | float | 0.5 | Confidence level |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | npt.NDArray | npt.NDArray: Indices of y_prob that satisfy threshold |

Source: `helia_edge/metrics/threshold.py:16`

## helia_edge.metrics.threshold.threshold_predictions

`function` · `python`

```python
threshold_predictions(
    y_prob: npt.NDArray,
    y_pred: npt.NDArray,
    y_true: npt.NDArray,
    threshold: float = 0.5,
) -> tuple[npt.NDArray, npt.NDArray, npt.NDArray]
```

Get prediction indices that are above threshold (confidence level).
This is useful to remove weak predictions that can happen due to noisy data or poor model performance.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| y_prob | npt.NDArray | Required | Model output as probabilities |
| y_pred | npt.NDArray | Required | Model predictions. Defaults to None. |
| y_true | npt.NDArray | Required | True labels |
| threshold | float | 0.5 | Confidence level. Defaults to 0.5. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | tuple[npt.NDArray, npt.NDArray, npt.NDArray] | tuple[npt.NDArray, npt.NDArray, npt.NDArray]: Thresholded predictions |

Source: `helia_edge/metrics/threshold.py:40`
