ts_normalization: Normalize univariate timeseries

Description Usage Arguments Value Joined value columns Examples

View source: R/ts_normalization.R

Description

Normalize univariate timeseries

Usage

1
2
3
4
5
6
7
8
ts_normalization(
  data,
  length_val,
  length_test,
  value_col = "value",
  joined = TRUE,
  metrics = FALSE
)

Arguments

data

univariate time series (data.frame / data.table)

length_val

length for validation set

length_test

length for test set

value_col

column(s) to normalize, searched by starting pattern. E.g. value_col = "index" will catch column "index" and "index_2" but not "2_index"

joined

joined normalization for same pattern? TRUE by default. See section "Joined value columns" for details

metrics

return data only or list of data and metrics?

Value

Depending on metrics, processed DT object or list of "data" and "metrics" (center and scale)

Joined value columns

Joined means to normalize all columns detected by pattern with the one column exactly matching. Watch out for this condition to hold if joined = TRUE.
joined is of particular use for lagged time series. E.g. column "value" should be used to normalize not only column "value" but also "value_lag1" etc.

Examples

1
2
3
4
5
# without metrics
DT_norm <- ts_normalization(tsRNN::DT_apple, 10, 10); DT_norm

# with metrics
ts_normalization(tsRNN::DT_apple, 10, 10, metrics = TRUE)

thfuchs/fcf documentation built on April 18, 2021, 1:43 p.m.