View source: R/dsg_benchmark.R
| dsg_source_data | R Documentation |
Turns a real-world data stream into a dsg_source() whose real
and virtual drift are controlled (Hinder et al., 2026). The stream, assumed
to be in time order, is split into blocks twice:
virtual_blocks time segments give the feature distributions, sampled
with replacement from the rows of each segment (virtual drift);
real_blocks time segments are given to a model of
P(y \mid \tilde{T}, x), where \tilde{T} is the segment index; the
labels of every concept are sampled from that model with the index of a
segment fixed (real drift).
Labelling the data of any feature segment with the model of any label
segment separates the virtual drift between segments from the real drift
learned by the model, giving (virtual_blocks + 1) * (real_blocks + 1)
concepts with known drift between them.
dsg_source_data(
data,
target,
real_blocks = 5,
virtual_blocks = 5,
model = NULL,
nodesize = 10,
n_clusters = 0,
n_ignore = 3,
...
)
data |
Data frame with the stream in time order. Every column but
|
target |
Name of the label column. |
real_blocks, virtual_blocks |
Number of segment boundaries (giving one more segment), or the boundaries themselves as relative positions in (0, 1) or as row indices. |
model |
Function |
nodesize |
Minimum leaf size of the default random forest. |
n_clusters |
When greater than 0, the real drift is enhanced with
region-wise label flips: the data are split into
|
n_ignore |
Controls the share of clusters that are never flipped. |
... |
Further arguments for |
With the default model, obj$quality holds the out-of-bag
accuracy of the forest (how well the labelling model fits the data) and the
permutation importance of the segment index (how much real drift the model
found).
dsg_source object (also of class dsg_source_data)
Hinder, F., Brinkrolf, J., Lammers, K., and Hammer, B. (2026). Real vs. Virtual Drift: Creating Realistic Stream Learning Benchmarks. In ESANN 2026, 133-138.
set.seed(1)
n <- 600
x1 <- c(stats::rnorm(300), stats::rnorm(300, 2))
x2 <- stats::rnorm(n)
y <- as.integer(x2 > c(rep(0, 300), rep(1, 300)))
stream <- data.frame(x1, x2, y)
source <- dsg_source_data(stream, "y", real_blocks = 1, virtual_blocks = 1,
test_size = 200, n_perm = 200)
dsg_stream(source, "-v-r", batch_size = 100)$segments
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.