View source: R/as-ts-dataset.R
as_ts_dataset | R Documentation |
data.frame
-like objectCreate a torch dataset for time series data from a data.frame
-like object
as_ts_dataset( data, formula, timesteps, horizon = 1, sample_frac = 1, jump = 1, ... )
data |
( |
formula |
( |
timesteps |
( |
horizon |
( |
sample_frac |
( |
index |
( |
key |
( |
predictors |
( |
outcomes |
( |
categorical |
( |
scale |
( |
If scale
is TRUE, only the input variables are scale and not the outcome ones.
library(rsample) library(dplyr, warn.conflicts = FALSE) suwalki_temp <- weather_pl %>% filter(station == "SWK") debugonce(as_ts_dataset.data.frame) # Splitting on training and test data_split <- initial_time_split(suwalki_temp) train_ds <- training(data_split) %>% as_ts_dataset(tmax_daily ~ date + tmax_daily + rr_type, timesteps = 20, horizon = 1) train_ds[1] train_ds <- training(data_split) %>% as_ts_dataset(tmax_daily ~ date + tmax_daily + rr_type + lead(rr_type), timesteps = 20, horizon = 1) train_ds[1] train_ds <- training(data_split) %>% as_ts_dataset(tmax_daily ~ date + tmax_daily + rr_type + lead(tmin_daily), timesteps = 20, horizon = 1) train_ds[1]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.