EDDM | R Documentation |
This class implements the Early Drift Detection Method (EDDM), designed to detect concept drifts in online learning scenarios by monitoring the distances between consecutive errors. EDDM is particularly useful for detecting gradual drifts earlier than abrupt changes.
EDDM is a statistical process control method that is more sensitive to changes that happen more slowly and can provide early warnings of deterioration before the error rate increases significantly.
eddm_warning
Warning threshold setting.
eddm_outcontrol
Out-of-control threshold setting.
m_num_errors
Current number of errors encountered.
m_min_num_errors
Minimum number of errors to initialize drift detection.
m_n
Total instances processed.
m_d
Distance to the last error from the current instance.
m_lastd
Distance to the previous error from the last error.
m_mean
Mean of the distances between errors.
m_std_temp
Temporary standard deviation accumulator for the distances.
m_m2s_max
Maximum mean plus two standard deviations observed.
delay
Delay count since the last detected change.
estimation
Current estimated mean distance between errors.
warning_detected
Boolean indicating if a warning has been detected.
change_detected
Boolean indicating if a change has been detected.
new()
Initializes the EDDM detector with specific parameters.
EDDM$new(min_num_instances = 30, eddm_warning = 0.95, eddm_outcontrol = 0.9)
min_num_instances
Minimum number of errors before drift detection starts.
eddm_warning
Threshold for warning level.
eddm_outcontrol
Threshold for out-of-control level.
reset()
Resets the internal state of the EDDM detector.
EDDM$reset()
add_element()
Adds a new observation and updates the drift detection status.
EDDM$add_element(prediction)
prediction
Numeric value representing a new error (usually 0 or 1).
clone()
The objects of this class are cloneable with this method.
EDDM$clone(deep = FALSE)
deep
Whether to make a deep clone.
Early Drift Detection Method. Manuel Baena-Garcia, Jose Del Campo-Avila, Raúl Fidalgo, Albert Bifet, Ricard Gavalda, Rafael Morales-Bueno. In Fourth International Workshop on Knowledge Discovery from Data Streams, 2006.
Implementation: https://github.com/scikit-multiflow/scikit-multiflow/blob/a7e316d1cc79988a6df40da35312e00f6c4eabb2/src/skmultiflow/drift_detection/eddm.py
set.seed(123) # Setting a seed for reproducibility
data_part1 <- sample(c(0, 1), size = 100, replace = TRUE, prob = c(0.7, 0.3))
# Introduce a change in data distribution
data_part2 <- sample(c(0, 1), size = 100, replace = TRUE, prob = c(0.3, 0.7))
# Combine the two parts
data_stream <- c(data_part1, data_part2)
eddm <- EDDM$new()
for (i in 1:length(data_stream)) {
eddm$add_element(data_stream[i])
if (eddm$change_detected) {
message(paste("Drift detected!",i))
} else if (eddm$warning_detected) {
message(paste("Warning detected!",i))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.