# %% LOAD AND SETUP -----------------------------------------------------------
## suppress warnings regarding conflict between
## data.table::first and dplyr::first
suppressWarnings(
suppressMessages(
library(FluHospPrediction)
)
)
target <- "pkrate"
current_week <- 15
ltype <- "lambda-min"
# %% SUPER LEARNER (PEAK RATE) ------------------------------------------------
# ignore leave-one-out CV warning: specification intended due to- clustering
task <- suppressWarnings(
fhp_make_task(
target,
current_week = current_week,
lambda_type = ltype
)
)
# specify component learners and send to global environment
cat("\n\nLearners in Stack\n")
fhp_spec_learners(
learner_pat = "lasso|ridge",
verbose = TRUE,
currtask = task
)
# specify meta learner
fhp_metalearner <- make_learner(
Lrnr_solnp,
convex = TRUE,
metalearner_linear,
loss_absolute_error
)
# run the super learner algorithm
fhp_run_sl(
task,
write = FALSE,
current_week = current_week,
metalearner = fhp_metalearner,
output = "fit",
keep_extra = FALSE
)
devtools::session_info()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.