| dfr_mmqt | R Documentation |
Monitors a stream with a Multimodal QuantTree (mmqt()): the
observations are grouped in consecutive batches of nu rows, the first
n_train_batches batches train the model, and every later batch is
tested. Since it monitors the distribution of the observed features, it is
primarily used for virtual concept drift.
dfr_mmqt(target_feat = NULL, nu = 128, n_train_batches = 64, model = NULL, ...)
target_feat |
Names of the columns to be monitored. |
nu |
Number of observations per batch. |
n_train_batches |
Number of batches used for training. Ignored when
|
model |
A trained |
... |
Further arguments for |
Each batch is tested on its own (MMQT is a one-shot test, with a
false positive rate alpha per batch), so the detector reports a drift on
the last observation of every batch whose statistic exceeds the threshold
of its modality. reset_state() forgets the model it trained and trains a
new one on the next n_train_batches batches. Rows with missing values
are skipped.
dfr_mmqt object. After fit(), drifter_output holds, on the
last observation of every tested batch, the assigned modality, the
statistic and the threshold, and obj$model the trained model.
Stucchi, D., Magri, L., Carrera, D. and Boracchi, G. (2023). Multimodal batch-wise change detection. IEEE Transactions on Neural Networks and Learning Systems, 34(10), 6783-6797. doi:10.1109/TNNLS.2023.3294846
Boracchi, G., Carrera, D., Cervellera, C. and Maccio, D. (2018). QuantTree: histograms for change detection in multivariate data streams. Proceedings of the 35th International Conference on Machine Learning, PMLR 80, 639-648.
library(daltoolbox)
library(heimdall)
# Batches alternate between two modes; from batch 50 the first mode moves.
set.seed(1)
batch <- function(center) data.frame(x = stats::rnorm(64, center), y = stats::rnorm(64, center))
centers <- c(rep(c(0, 4), 25), rep(c(1.5, 4), 10))
stream <- do.call(rbind, lapply(centers, batch))
detector <- dfr_mmqt(nu = 64, n_train_batches = 40, bins = 8, n_repeats = 2, n_sim = 2000, seed = 1)
model <- fit(detector, stream)
model$model$n_modalities
which(model$drifter_output$statistic > model$drifter_output$threshold) %/% 64
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.