energy_fault_detector.core.threshold_selector
- class ThresholdSelector(*args: Any, **kwargs: Any)
Bases:
BaseEstimator,ClassifierMixin,SaveLoadMixinTemplate for threshold selectors.
Finds the threshold (fit method) of the given reconstruction errors (x), to be considered anomalous. The predict method returns an array of boolean, indicating which samples of the input are anomalous.
- threshold
scores above the threshold is classified as anomaly, below is classified as normal.
- __sklearn_is_fitted__()
Needed for check_is_fitted
- fit(x, y=None)
Fit ThresholdSelector object on anomaly score values x and labels y to determine the score threshold. For prediction, every sample with a scores above this threshold is considered an anomaly.
- Parameters:
x (
Union[ndarray,Series]) – array or pandas Series with calculated anomaly scoresy (
Union[ndarray,Series]) – labels indicating whether sample is normal (True) or anomalous (False) Optional, if not given, we assume all data provided represents normal behaviour
- Return type:
- Returns:
The threshold selector
- predict(x, **kwargs)
Return a boolean array indicating whether sample is anomalous.
- Parameters:
x (
Union[ndarray,Series]) – array with calculated anomaly scoreskwargs – other arguments for specific threshold selectors.
- Return type:
Union[ndarray,Series,Tuple[Union[ndarray,Series],Union[ndarray,Series]]]- Returns:
Boolean array where true = anomaly, false = normal