I'm reading some documentation on tidymodels::last_fit(). The provided example is:
library(recipes)
library(rsample)
library(parsnip)
set.seed(6735)
tr_te_split <- initial_split(mtcars)
spline_rec <- recipe(mpg ~ ., data = mtcars) %>%
step_ns(disp)
lin_mod <- linear_reg() %>%
set_engine("lm")
spline_res <- last_fit(lin_mod, spline_rec, split = tr_te_split)
spline_res
In this example tr_te_split is used to pass to last_fit().
In my case I have manually split my data based on time, e.g. 11 months training, most recent month for testing.
Is there some way that I use last_fit() and instead of a rsample split object, instead pass a train and test df?