percentile_threshold

percentile_threshold(y_score: ndarray, percentile: int) float[source]

Calculate a threshold based on a percentile of the anomaly scores.

Uses the xth-percentile of the anomaly scoring as threshold ignoring NaNs and using a linear interpolation.

Parameters:
y_scorenp.ndarray

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

percentileint

Percentile to use as threshold between 0 and 100.

Returns:
float

Threshold based on the percentile.