OA-STREAMS-TASKS - Anomaly Detectors

content/99_appendices/appendix2/sub/core/mlpro_oa/streams/tasks/images/MLPro-OA-Anomaly_Detectors_class_diagram.drawio.png

Ver. 1.0.0 (2023-06-23) This module provides templates for anomaly detection to be used in the context of online adaptivity.

class mlpro.oa.streams.tasks.anomalydetectors.AnomalyDetector(p_name: str = None, p_range_max=1, p_ada: bool = True, p_duplicate_data: bool = False, p_visualize: bool = False, p_logging=True, **p_kwargs)

Bases: OATask

This is the base class for multivariate online anomaly detectors. It raises an event when an anomaly is detected.

C_NAME = 'Anomaly Detector'
C_TYPE = 'Anomaly Detector'
C_EVENT_ANOMALY = 'ANOMALY'
_run(p_inst_new: list, p_inst_del: list)

Custom method that is called by method run().

Parameters:
  • p_inst_new (set) – Set of new stream instances to be processed.

  • p_inst_del (set) – Set of obsolete stream instances to be removed.

class mlpro.oa.streams.tasks.anomalydetectors.AnomalyDetectorCB(p_threshold=5.0, p_centroid_threshold=1.0, p_name: str = None, p_range_max=1, p_ada: bool = True, p_duplicate_data: bool = False, p_visualize: bool = False, p_logging=True, **p_kwargs)

Bases: AnomalyDetector

C_TYPE = 'Cluster based Anomaly Detector'
_run(p_inst_new: list, center: float, centroids: list)

Custom method that is called by method run().

Parameters:
  • p_inst_new (set) – Set of new stream instances to be processed.

  • p_inst_del (set) – Set of obsolete stream instances to be removed.

class mlpro.oa.streams.tasks.anomalydetectors.AnomalyEvent(p_raising_object, p_det_time: str, p_instance: str, **p_kwargs)

Bases: Event

C_TYPE = 'Event'
C_NAME = 'Anomaly'
class mlpro.oa.streams.tasks.anomalydetectors.PointAnomaly(p_raising_object, p_det_time: str, p_instance: str, p_deviation: float, **p_kwargs)

Bases: AnomalyEvent

C_NAME = 'Point Anomaly'
class mlpro.oa.streams.tasks.anomalydetectors.GroupAnomaly(p_raising_object, p_det_time: str, p_instances: list, p_mean: float, p_mean_deviation: float, **p_kwargs)

Bases: AnomalyEvent

C_NAME = 'Group Anomaly'
class mlpro.oa.streams.tasks.anomalydetectors.ContextualAnomaly(p_raising_object, p_det_time: str, p_instance: str, **p_kwargs)

Bases: AnomalyEvent

C_NAME = 'Contextual Anomaly'
class mlpro.oa.streams.tasks.anomalydetectors.DriftEvent(p_raising_object, p_det_time: str, p_magnitude: float, p_rate: float, **p_kwargs)

Bases: AnomalyEvent

C_NAME = 'Drift'
class mlpro.oa.streams.tasks.anomalydetectors.DriftEventCB(p_raising_object, p_det_time: str, **p_kwargs)

Bases: DriftEvent

C_NAME = 'Cluster based Drift'