sample_intervals: Sample intervals for time series random forest

Description Usage Arguments Value Examples

View source: R/intervals.R

Description

Randomly samples O(M) intervals (start and end indices) from a time series, where M is the length of the time series.

Usage

1

Arguments

m

time series length (numeric scalar)

Value

a matrix with two columns: start and end index of intervals.

Examples

1
2
3
4
5
6
7
8
# More intervals will cover the middle of the time series than the ends
n <- 1000
intervals <- sample_intervals(seq(n))
prevalence <- sapply(
  seq(n),
  function(i) sum(i >= intervals[, 1] & i <= intervals[, 2]) / nrow(intervals)
)
plot(seq(n), prevalence, type = "l", xlab = "index")

FlukeAndFeather/tsrf documentation built on Dec. 17, 2021, 8:29 p.m.