dfr_kldist {heimdall}R Documentation

KL Distance method

Description

Kullback Leibler Windowing method for concept drift detection.

Usage

dfr_kldist(target_feat, window_size = 100, p_th = 0.9, data = NULL)

Arguments

target_feat

Feature to be monitored.

window_size

Size of the sliding window (must be > 2*stat_size)

p_th

Probability theshold for the test statistic of the Kullback Leibler distance.

data

Already collected data to avoid cold start.

Value

dfr_kldist object

Examples

library(daltoolbox)
library(heimdall)

# This example uses a dist-based drift detector with a synthetic dataset.

data(st_drift_examples)
data <- st_drift_examples$univariate
data$event <- NULL

model <- dfr_kldist(target_feat='serie')

detection <- NULL
output <- list(obj=model, drift=FALSE)
for (i in 1:length(data$serie)){
 output <- update_state(output$obj, data$serie[i])
 if (output$drift){
   type <- 'drift'
   output$obj <- reset_state(output$obj)
 }else{
   type <- ''
 }
 detection <- rbind(detection, data.frame(idx=i, event=output$drift, type=type))
}

detection[detection$type == 'drift',]

[Package heimdall version 1.0.717 Index]