alibi_detect.od.sklearn.base

FitMixinSklearn

Inherits from: ABC

Methods

check_fitted

check_fitted()

Checks to make sure object has been fitted.

fit

fit(x_ref: numpy.ndarray) -> typing_extensions.Self

Abstract fit method.

Name
Type
Default
Description

x_ref

numpy.ndarray

x

torch.Tensor to fit object on.

Returns

  • Type: typing_extensions.Self

SklearnOutlierDetector

Inherits from: FitMixinSklearn, ABC

Base class for sklearn backend outlier detection algorithms.

Methods

check_threshold_inferred

check_threshold_inferred()

Check if threshold is inferred.

infer_threshold

infer_threshold(x: numpy.ndarray, fpr: float) -> None

Infer the threshold for the data. Prerequisite for outlier predictions.

Name
Type
Default
Description

x

numpy.ndarray

Data to infer the threshold for.

fpr

float

False positive rate to use for threshold inference.

Returns

  • Type: None

predict

predict(x: numpy.ndarray) -> alibi_detect.od.sklearn.base.SklearnOutlierDetectorOutput

Predict outlier labels for the data.

Computes the outlier scores. If the detector is not fit on reference data we raise an error. If the threshold is inferred, the outlier labels and p-values are also computed and returned. Otherwise, the outlier labels and p-values are set to None.

Name
Type
Default
Description

x

numpy.ndarray

Data to predict.

Returns

  • Type: alibi_detect.od.sklearn.base.SklearnOutlierDetectorOutput

score

score(x: numpy.ndarray) -> numpy.ndarray

Score the data.

Name
Type
Default
Description

x

numpy.ndarray

Data to score.

Returns

  • Type: numpy.ndarray

SklearnOutlierDetectorOutput

Output of the outlier detector.

Fields

Field
Type
Default

threshold_inferred

bool

``

instance_score

numpy.ndarray

``

threshold

Optional[numpy.ndarray]

``

is_outlier

Optional[numpy.ndarray]

``

p_value

Optional[numpy.ndarray]

``

Constructor

SklearnOutlierDetectorOutput(self, threshold_inferred: bool, instance_score: numpy.ndarray, threshold: Optional[numpy.ndarray], is_outlier: Optional[numpy.ndarray], p_value: Optional[numpy.ndarray]) -> None
Name
Type
Default
Description

threshold_inferred

bool

instance_score

numpy.ndarray

threshold

Optional[numpy.ndarray]

is_outlier

Optional[numpy.ndarray]

p_value

Optional[numpy.ndarray]

Last updated

Was this helpful?