AnomalyDetector#

class capymoa.base.AnomalyDetector[source]#

Bases: LearnerParamsMixin, ABC

Abstract base class for anomaly detector.

Attributes: - schema: The schema representing the instances. Defaults to None. - random_seed: The random seed for reproducibility. Defaults to 1.

__init__(schema: Schema, random_seed=1)[source]#
classmethod from_params(
schema: Any = None,
params: dict[str, Any] | None = None,
random_seed: int = 1,
) → Any[source]#

Construct an instance from parameters produced by get_params.

get_params() → dict[str, Any][source]#

Return the hyper-parameters captured from the constructor.

abstract predict(instance: Instance) → int | None[source]#
abstract score_instance(instance: Instance) → float[source]#

Returns the anomaly score for the instance.

A high score is indicative of an anomaly.

Parameters:

instance – The instance for which the anomaly score is calculated.

Returns:

The anomaly score for the instance.

abstract train(instance: Instance)[source]#