| dfr_indid | R Documentation |
Monitors a stream with a trained indid() model: the
observations are fed one by one to the recurrent network, and a drift is
reported when the probability of change exceeds threshold. Since the model
is trained on labelled sequences of the monitored features, it detects the
kinds of change it was trained on (virtual concept drift of those
features).
dfr_indid(model, threshold = 0.5, target_feat = NULL, horizon = NULL)
model |
A trained |
threshold |
Alarm threshold on the probability of change. |
target_feat |
Names of the columns fed to the model, in the order of
training. |
horizon |
If set, the state of the network is reset every |
After a drift the state of the network is reset, so the data after the change are read as the start of a new sequence. The model has learned what the beginning of a sequence without change looks like, so it keeps raising alarms if the new regime does not resemble it. Rows with missing values are skipped.
dfr_indid object. After fit(), drifter_output holds the
probability of change of every observation (probability).
Romanenkova, E., Stepikin, A., Morozov, M. and Zaytsev, A. (2022). InDiD: Instant disorder detection via a principled neural network. Proceedings of the 30th ACM International Conference on Multimedia, 3152-3162. doi:10.1145/3503161.3548182
library(daltoolbox)
library(heimdall)
set.seed(1)
make <- function(n) {
change <- sample(2:32, n, replace = TRUE)
change[seq_len(n / 2)] <- 33
x <- t(vapply(change, function(c) stats::rnorm(32, ifelse(seq_len(32) < c, 1, 6)), numeric(32)))
labels <- t(vapply(change, function(c) (seq_len(32) >= c) * 1, numeric(32)))
list(x = x, labels = labels)
}
train <- make(200)
model <- indid(train$x, train$labels, T = 8, learning_rate = 0.02, epochs = 30, seed = 1)
stream <- data.frame(value = c(stats::rnorm(20, 1), stats::rnorm(10, 6)))
detector <- fit(dfr_indid(model), stream)
which(detector$drifter_output$probability > 0.5)[1]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.