clear_outcome: Partially clear outcome variable in new data by overriding...

View source: R/utils.R

clear_outcomeR Documentation

Partially clear outcome variable in new data by overriding with NA values

Description

Partially clear outcome variable in new data by overriding with NA values

Usage

clear_outcome(data, index, outcome, timesteps, key = NULL)

Arguments

data

(data.frame) New data

index

Date variable

outcome

Outcome (target) variable

timesteps

(integer) Number of timesteps used by RNN model

key

A key (id) to group the data.frame (for panel data)

Examples

tarnow_temp <-
  weather_pl %>%
  filter(station == "TRN") %>%
  select(date, tmax_daily, tmin_daily, press_mean_daily)

TIMESTEPS <- 20
HORIZON   <- 1

data_split <-
  time_series_split(
    tarnow_temp, date,
    initial = "18 years",
    assess  = "2 years",
    lag     = TIMESTEPS
  )

cleared_new_data <-
  testing(data_split) %>%
  clear_outcome(date, tmax_daily, TIMESTEPS)

head(cleared_new_data, TIMESTEPS + 10)


krzjoa/torchts documentation built on June 24, 2022, 5:30 a.m.