Learning how to use drake with tidymodels.
Something about using rsample's initial_time_split(), rather than just initial_split(), is giving me an error, when I run make(plan). I get the following:
#> > target data
#> > target split_data
#> Error in UseMethod("complement"): no applicable method for 'complement' applied to an object of class "rsplit"
Have really been racking my brain on this one. The function works fine, independently (ie. the following works):
I feel like I am missing something pretty basic.
Here is the full drake process in a single file (so that it is easier to post up on stack overflow).
Thanks in advance for the hints, as to what I'm doing wrong.
library(drake)
library(tidyverse)
library(tidymodels)
###################################################################
generate_data <- function() {
tibble(x = rnorm(1e5), y = rnorm(1e5))
}
split_the_data <- function(data) {
data %>%
initial_time_split()
}
fit_model <- function(data) {
summary(lm(y ~ x, data = data))
}
###################################################################
plan <- drake_plan(
data = generate_data(),
split_data = split_the_data(data),
model = fit_model(training(split_data))
)
###################################################################
make(plan)