Create a random stream such that the first 500 observations come from a normal distribution with mean 2 and standard deviation 0.75 and the next 500 come from a normal distribution with mean 4 and standard deviation 1. In an incremental drift detection application, access to data stream and model update would happen consecutively. However, for the purpose of clarification, this example demonstrates the simulation of data separately.
Initiate the incremental concept drift detector. Utilize the Hoeffding's bound method with exponential moving average method (HDDMA). Specify the input type as continuous, a warmup of 50 observations, and an estimation period of 50 observations.
incCDDetector =
HoeffdingDriftDetectionMethod
PreviousDriftStatus: 'Stable'
DriftStatus: 'Stable'
IsWarm: 0
NumTrainingObservations: 0
Alternative: 'greater'
InputType: 'continuous'
TestMethod: 'average'
Properties, Methods
incDDetector
is a HoeffdingDriftDetectionMethod
object. When you first create the object, properties such as DriftStatus
, IsWarm
, CutMean
, and NumTrainingObservations
are at their initial state. detectdrift
updates them as you feed the data incrementally and monitor for drift.
Simulate the data stream of one observation at a time and perform incremental drift detection until a drift is detected.
ans =
"Drift detected at observation #518."
incCDDetector =
HoeffdingDriftDetectionMethod
PreviousDriftStatus: 'Warning'
DriftStatus: 'Drift'
IsWarm: 1
NumTrainingObservations: 467
Alternative: 'greater'
InputType: 'continuous'
TestMethod: 'average'
Properties, Methods
The drift status switched from a Warning
to a Drift
(drift is detected) at observation 518. detectdrift
starts updating the internal statistics after the estimation period, which is 50, hence the number of training observations is 467.
Reset and investigate the drift detector.
incCDDetector =
HoeffdingDriftDetectionMethod
PreviousDriftStatus: 'Stable'
DriftStatus: 'Stable'
IsWarm: 0
NumTrainingObservations: 0
Alternative: 'greater'
InputType: 'continuous'
TestMethod: 'average'
Properties, Methods
reset
function resets the internal statistics such as CutMean
, PostCutMean
, InputBounds
, and NumTrainingObservations
, the drift statuses PreviousDriftStatus
and DriftStatus
, and the indicators IsWarm
, DriftDetected
, and WarningDetected
.