energy_fault_detector.threshold_selectors.quantile_threshold

class QuantileThresholdSelector(quantile=0.99)

Bases: ThresholdSelector

Find a threshold by defining a specified quantile of the given anomaly scores.

Parameters:

quantile (float) – The quantile of the scores to be computed. Defaults to 0.99.

threshold

Scores above the threshold are classified as anomalies, while scores below are classified as normal.

Type:

float

Example Configuration:

train:
  threshold_selector:
    name: QuantileThresholdSelector
    params:
      quantile: 0.99
fit(x, y=None)

Sets the threshold to the chosen quantile of the provided anomaly scores.

Parameters:
  • x (Array1D) – Array containing calculated anomaly scores.

  • y (pd.Series, optional) – Labels indicating whether each sample is normal (True) or anomalous (False). Optional; if not provided, it is assumed that all data represents normal behavior.

Returns:

The instance of this class after setting the threshold.

Return type:

QuantileThresholdSelector

Raises:

Warning – If a suitable threshold cannot be found, the threshold is set to the maximum score.