super_learner_proc: Super Learner Procedure

fhp_make_taskR Documentation

Super Learner Procedure

Description

Functions used to specify and execute the ensemble learning procedure.

Usage

fhp_make_task(target, current_week, lambda_type, prosp = NULL, holdout = NULL)

fhp_spec_learners(learner_pat = "^lrnr_", currtask, verbose = FALSE)

fhp_run_sl(
  task,
  write = TRUE,
  returnobj = FALSE,
  results_path = "~/scratch",
  current_week,
  output = c("tailored", "fit"),
  set_keep_extra = FALSE,
  ...
)

get_week(w = NULL, slurm = TRUE)

Arguments

target

One of "pkrate", "pkweek", or "cumhosp". No default.

current_week

The week number at which predictions are made.

lambda_type

Pick the curves simulated based on trendfilter lambda. Should be one of "lambda-min" or "lambda-1se".

prosp

A character string naming an observed season to predict on, example "2015-16". The super learner will be fit on simulated curves based only on prior seasons. Default is NULL to avoid interfering with the specification of tasks in the original main and sensitivity analyses.

holdout

A digit from 1-15, indicating which tmeplate's curves to holdout from training. Like 'prosp', default is NULL to avoid interfering with task specifications in the main and sensitivity analyses.

learner_pat

Regular expression specifying which learners to include in the learner stack. Defaults to "^lrnr_", which adds any object whose name starts with "lrnr" in the global environment to the learner stack. To select a specific subset of learners, provide appropriate regex.

currtask

Machine learning task as produced by the sl3 package. Used to calculate number of covariates to sample in random forest learners.

verbose

Logical indicating whether to print the full component learner stack. Defaults to FALSE.

task

A learning task created by 'fhp_make_task()'.

write

A logical indicating whether to write results to a file. Defaults to TRUE.

returnobj

Return object as a normal function would. Defaults to FALSE.

results_path

Relative to project root, where to save the results files.

output

One of 'tailored' or 'fit'. The first returns an object with selected elements from the super learner algorithm, while the second returns the super learner fit object itself.

set_keep_extra

Set the argument 'keep_extra' in 'Lrnr_sl$new()'. Defaults to FALSE.

...

Pass arguments to Lrnr_sl$new(...)

w

Numerical integer week (1–30). Used in script testing.

slurm

Logical indicating whether job is submitted via batch script in SLURM. If TRUE, will take job ID from job array.

Value

A list containing the sl3 tasks for each week of the flu season.

Functions

  • fhp_make_task(): Specify learning tasks for each week.

  • fhp_spec_learners(): Specify all the component learners and assign them to the global environment.

  • fhp_run_sl(): Runs the parallelized super learner procedure based on 'fhp_make_tasks()' and 'fhp_spec_learners()'.

  • get_week(): Specifies the week for which to run the super learner algorithm.


jrgant/FluHospPrediction documentation built on May 7, 2023, 10:40 a.m.