skmultiflow.drift_detection.
PageHinkley
Page-Hinkley method for concept drift detection.
The minimum number of instances before detecting change.
The delta factor for the Page Hinkley test.
The change detection threshold (lambda).
The forgetting factor, used to weight the observed value and the mean.
Notes
This change detection method works by computing the observed values and their mean up to the current moment. Page-Hinkley won’t output warning zone warnings, only change detections. The method works by means of the Page-Hinkley test [1]. In general lines it will detect a concept drift if the observed mean at some instant is greater then a threshold value lambda.
References
E. S. Page. 1954. Continuous Inspection Schemes. Biometrika 41, 1/2 (1954), 100–115.
Examples
>>> # Imports >>> import numpy as np >>> from skmultiflow.drift_detection import PageHinkley >>> ph = PageHinkley() >>> # Simulating a data stream as a normal distribution of 1's and 0's >>> data_stream = np.random.randint(2, size=2000) >>> # Changing the data concept from index 999 to 2000 >>> for i in range(999, 2000): ... data_stream[i] = np.random.randint(4, high=8) >>> # Adding stream elements to the PageHinkley drift detector and verifying if drift occurred >>> for i in range(2000): ... ph.add_element(data_stream[i]) ... if ph.detected_change(): ... print('Change has been detected in data: ' + str(data_stream[i]) + ' - of index: ' + str(i))
Methods
add_element(self, x)
add_element
Add a new element to the statistics
detected_change(self)
detected_change
This function returns whether concept drift was detected or not.
detected_warning_zone(self)
detected_warning_zone
If the change detector supports the warning zone, this function will return whether it’s inside the warning zone or not.
get_info(self)
get_info
Collects and returns the information about the configuration of the estimator
get_length_estimation(self)
get_length_estimation
Returns the length estimation.
get_params(self[, deep])
get_params
Get parameters for this estimator.
reset(self)
reset
Resets the change detector parameters.
set_params(self, **params)
set_params
Set the parameters of this estimator.
Attributes
estimator_type
The observed value, from which we want to detect the concept change.
After calling this method, to verify if change was detected, one should call the super method detected_change, which returns True if concept drift was detected and False otherwise.
Whether concept drift was detected or not.
Whether the change detector is in the warning zone or not.
Configuration of the estimator.
The length estimation
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
<component>__<parameter>