PageHinkley#
- class capymoa.drift.detectors.PageHinkley[source]#
Bases:
MOADriftDetector
Page-Hinkley Drift Detector
Example:#
>>> import numpy as np >>> from capymoa.drift.detectors import PageHinkley >>> np.random.seed(0) >>> >>> detector = PageHinkley() >>> >>> data_stream = np.random.randint(2, size=2000) >>> for i in range(999, 2000): ... data_stream[i] = np.random.randint(4, high=8) >>> >>> for i in range(2000): ... detector.add_element(data_stream[i]) ... if detector.detected_change(): ... print('Change detected in data: ' + str(data_stream[i]) + ' - at index: ' + str(i)) Change detected in data: 7 - at index: 1014 Change detected in data: 7 - at index: 1685
Reference:#
Page. 1954. Continuous Inspection Schemes. Biometrika 41, 1/2 (1954), 100-115.
- __init__(
- min_n_instances: int = 30,
- delta: float = 0.005,
- lambda_: float = 50.0,
- alpha: float = 0.9999,
- CLI: str | None = None,
- Parameters:
moa_detector – The MOA detector object or class identifier.
CLI – The command-line interface (CLI) configuration for the MOA drift detector, defaults to None