processStream:

Usage Arguments Examples

Usage

1
processStream(dsd, alg, N, window.step = 10, plot = F)

Arguments

dsd
alg
N
window.step
plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (dsd, alg, N, window.step = 10, plot = F) 
{
    ds <- NULL
    measures <- c()
    begin.time <- Sys.time()
    while (T) {
        ret <- tryCatch(p <- get_points(dsd, n = window.step, 
            outofpoints = "warn", assignment = T), warning = function(w) {
            w
        })
        if ("warning" %in% class(ret)) {
            break
        }
        ds <- rbind(ds, p)
        update(alg, p)
        val <- getMeasure(alg)
        measures <- c(measures, val)
    }
    if (plot) {
        plot(ds[, 1], pch = ".")
        par(new = T)
        times <- seq(window.step, nrow(ds), by = window.step)
        plot(times, measures, type = "l", lwd = 2, col = 2, axes = F)
        abline(v = which(ds[, 2] == 1))
        axis(4, at = pretty(measures))
    }
    ret = list()
    ret$ds <- ds
    ret$measures <- measures
    ret$total.time <- as.numeric(Sys.time() - begin.time, units = "secs")
    ret
  }

faustogc/streamChaos documentation built on May 8, 2019, 9:22 a.m.