| dfr_llr2 | R Documentation |
Fully unsupervised drift detector of Sojo, Bielza and Larrañaga
(2027). A semiparametric Bayesian network (spbn()) is learned on a
baseline of the stream. For every node i, the statistic
Lambda_i = mean log f(x_i | pa_i) over the most recent sliding window minus
the same mean over a fixed reference window is compared with the chi-square
distribution with one degree of freedom, p_i = 1 - F(2 |Lambda_i|); a drift
is reported when some p_i < alpha (or, with fdr = TRUE, when the
Benjamini-Hochberg procedure rejects some node at level alpha: LLR2-BH).
The nodes that drift are reported, and the network is updated.
dfr_llr2(
target_feat = NULL,
n_baseline = 4096,
window_size = 250,
step = 50,
alpha = 0.05,
fdr = FALSE,
update = c("parameter", "parameter_sliding", "sliding", "none"),
structure = NULL,
node_types = NULL,
max_parents = 4,
folds = 5
)
target_feat |
Names of the columns to be monitored. |
n_baseline |
Size of the baseline: the first |
window_size |
Size of the sliding and reference windows ( |
step |
Stride of the sliding window: the test is run on observations
whose position in the stream is a multiple of |
alpha |
Significance level. |
fdr |
|
update |
Update after a drift: |
structure, node_types, max_parents, folds |
Passed to |
After a drift the reference window is emptied; the first full
sliding window after the drift becomes the new reference window (its mean
log-likelihood under the updated network) and tests resume at the next
stride. This reproduces the spacing of the detections of the reference
results (at least window_size + step observations between two drifts).
The "parameter" update follows Section 4.3: for every node, the CPD
fitted on the sliding window (target, weight eta = window_size / |W_l|)
is combined with the CPD fitted on the learning window (source, weight
1 - eta); if the risk |L_T| - |L_S| (cross-validated log-likelihood of
the sliding window under the target CPD against its log-likelihood under the
source) is not positive, the source is dropped (eta = 1). The structure is
kept; the paper also relearns the structure around the drifted nodes by hill
climbing with transfer learning (HC-TL), which is not implemented. Its
ablation (Fig. 12) shows that detection is driven by the statistic, with
equivalent results for the parameter and sliding updates.
dfr_llr2 object. After fit(), drifter_output holds, for every
observation, its log-likelihood under the network in use (loglik) and, on
tested observations, the p-value of every node (p_<node>); obj$drifts
lists the drifts with their nodes, and obj$network the current network.
Sojo, R., Bielza, C. and Larrañaga, P. (2027). A fully unsupervised concept drift detector via Bayesian networks for machine condition monitoring. Expert Systems with Applications, 332, 133634. doi:10.1016/j.eswa.2026.133634
spbn()
library(daltoolbox)
library(heimdall)
set.seed(1)
n <- 3000
a <- stats::rnorm(n)
b <- a + stats::rnorm(n, sd = 0.5)
b[2001:n] <- b[2001:n] + 2
detector <- dfr_llr2(n_baseline = 1000, window_size = 200, step = 50)
model <- fit(detector, data.frame(a, b))
model$drifts
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.