-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruntime.R
28 lines (23 loc) · 821 Bytes
/
runtime.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Generated by the vetiver package; edit with care
# Required to stop pins from trying to write to the home directory
# See https://github.com/rstudio/pins-r/issues/611
Sys.setenv(PINS_USE_CACHE = "true")
library(pins)
library(lambdr)
library(vetiver)
# Packages needed to generate model predictions
library(earth)
library(parsnip)
library(workflows)
b <- board_s3(bucket = "CENSORED")
v <- vetiver_pin_read(b, "simpsons", version = "20220813T224517Z-b6960")
# This function is not auto-generated. We would normally get this from vetiver,
# but it's not available in the CRAN version
lambdr_predict <- function(v) {
function(...) {
new_data <- vetiver_type_convert(data.frame(...), v$ptype)
predict(v$model, new_data = new_data)
}
}
vetiver_predict <- function(...) lambdr_predict(v)(...)
start_lambda()