Skip to contents

A ListDataset is the format required by GluonTS. This function simplifies creating a GluonTS ListDataset.

Usage

to_gluon_list_dataset(data, date_var, value_var, id_var = NULL, freq = "D")

Arguments

data

A data.frame

date_var

The date column (Timestamps)

value_var

The value column (Target)

id_var

The Time Series ID column for tracking time series in GluonTS

freq

the Pandas Timestamp Frequency.

Examples

# \donttest{
library(timetk)

m4_daily %>%
    to_gluon_list_dataset(
        date_var  = date,
        value_var = value,
        id_var    = id,
        freq      = "D"
    )
#> Error in purrr::map(., .f = function(df) {    idx <- df %>% dplyr::pull(!!date_var_expr)    val <- df %>% dplyr::pull(!!value_var_expr)    grp <- df %>% dplyr::pull(!!id_var_expr)    reticulate::dict(start = as_pandas_timestamp(idx[1], freq = freq),         target = pkg.env$np$array(val), item_id = as.character(grp[1]))}):  In index: 1.
#> Caused by error in `pkg.env$pd$Timestamp()`:
#> ! attempt to apply non-function
# }