sigma_threshold

sigma_threshold(y_score: ndarray, factor: float = 2) float[source]

Calculate a threshold based on the standard deviation of the anomaly scores.

Computes a threshold \(\theta\) based on the anomaly scoring’s mean \(\mu_s\) and the standard deviation \(\sigma_s\), ignoring NaNs:

\[\theta = \mu_{s} + x \cdot \sigma_{s}\]
Parameters:
y_scorenp.ndarray

Anomaly scores for each point of the time series of shape (n_instances,).

factorfloat

Number of standard deviations to use as threshold (\(x\)).

Returns:
float

Threshold based on the standard deviation.