Sometimes we want to see the training and testing data in a plot. This is a
simple wrapper around a couple of functions from the timetk
package.
Details
You should already have a splits object defined. This function takes in three parameters, the splits object, a date column and the value column.
See also
https://business-science.github.io/timetk/reference/plot_time_series_cv_plan.html(tk_time_sers_cv_plan)
https://business-science.github.io/timetk/reference/plot_time_series_cv_plan.html(plot_time_series_cv_plan)
Examples
suppressPackageStartupMessages(library(modeltime))
suppressPackageStartupMessages(library(timetk))
suppressPackageStartupMessages(library(dplyr))
data <- ts_to_tbl(AirPassengers) %>%
select(-index)
splits <- time_series_split(
data
, date_col
, assess = 12
, skip = 3
, cumulative = TRUE
)
ts_splits_plot(
.splits_obj = splits,
.date_col = date_col,
.value_col = value
)