Skip to content
heliaEDGE
Reference
HELIA

threshold

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

Machine-readable model

function

Get prediction indices that are above threshold (confidence level).

helia_edge/metrics/threshold.py:16

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 of get_predicted_threshold_indices
NameTypeDefaultDescription
y_probnpt.NDArrayRequiredModel output as probabilities
y_prednpt.NDArrayRequiredModel predictions. Defaults to None.
thresholdfloat0.5Confidence level
Returns of get_predicted_threshold_indices
TypeDescription
npt.NDArraynpt.NDArray: Indices of y_prob that satisfy threshold
function

Get prediction indices that are above threshold (confidence level).

helia_edge/metrics/threshold.py:40

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 of threshold_predictions
NameTypeDefaultDescription
y_probnpt.NDArrayRequiredModel output as probabilities
y_prednpt.NDArrayRequiredModel predictions. Defaults to None.
y_truenpt.NDArrayRequiredTrue labels
thresholdfloat0.5Confidence level. Defaults to 0.5.
Returns of threshold_predictions
TypeDescription
tuple[npt.NDArray, npt.NDArray, npt.NDArray]tuple[npt.NDArray, npt.NDArray, npt.NDArray]: Thresholded predictions