SEED#

class capymoa.drift.detectors.SEED[source]#

Bases: MOADriftDetector

Seed Drift Detector

Example:#

>>> import numpy as np
>>> from capymoa.drift.detectors import SEED
>>> np.random.seed(0)
>>>
>>> detector = SEED()
>>>
>>> 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: 4 - at index: 1023
Change detected in data: 6 - at index: 1343

Reference:#

Huang, David Tse Jung, et al. “Detecting volatility shift in data streams.” 2014 IEEE International Conference on Data Mining. IEEE, 2014.

__init__(
delta: float = 0.05,
block_size: int = 32,
epsilon_prime: float = 0.01,
alpha: float = 0.8,
compress_term: int = 75,
)[source]#

Create a SEED drift detector.

Parameters:
  • delta – Confidence parameter used in the ADWIN-style cut bound inside SEED. Smaller values make drift declarations more conservative. Defaults to 0.05.

  • block_size – Number of instances per block before drift checks are attempted. Defaults to 32.

  • epsilon_prime – Base homogeneity tolerance used by SEED block compression. Defaults to 0.01.

  • alpha – Growth parameter used with epsilon_prime during compression; larger values increase compression tolerance. Defaults to 0.8.

  • compress_term – Compression interval controlling how often fixed-term block compression is attempted. Defaults to 75.

add_element(element: float) None[source]#

Update the drift detector with a new input value.

Parameters:

element – A value to update the drift detector with. Usually, this is the prediction error of a model.

cli_help() str[source]#
detected_change() bool[source]#

Is the detector currently detecting a concept drift?

detected_warning() bool[source]#

Is the detector currently warning of an upcoming concept drift?

classmethod from_cli(cli: str) MOADriftDetector[source]#

Create a detector instance configured from a MOA CLI string.

Parameters:

cli – Command-line style options string for MOA detector hyper-parameters.

Returns:

A new detector instance initialized with cli.

get_params() Dict[str, Any][source]#

Get the hyper-parameters of the drift detector.

reset(clean_history: bool = False) None[source]#

Reset the drift detector.

Parameters:

clean_history – Whether to reset detection history, defaults to False