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 :math:\theta based on the anomaly scoring’s mean :math:\mu_s and the standard deviation :math:\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 (:math:x).

Returns:
float

Threshold based on the standard deviation.