frosting: Create frosting for postprocessing predictions

View source: R/frosting.R

frostingR Documentation

Create frosting for postprocessing predictions

Description

This generates a postprocessing container (much like recipes::recipe()) to hold steps for postprocessing predictions.

Usage

frosting(layers = NULL, requirements = NULL)

Arguments

layers

Must be NULL.

requirements

Must be NULL.

Details

The arguments are currently placeholders and must be NULL

Value

A frosting object.

Examples

# Toy example to show that frosting can be created and added for postprocessing
f <- frosting()
wf <- epi_workflow() %>% add_frosting(f)

# A more realistic example
jhu <- covid_case_death_rates %>%
  filter(time_value > "2021-11-01", geo_value %in% c("ak", "ca", "ny"))

r <- epi_recipe(jhu) %>%
  step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
  step_epi_ahead(death_rate, ahead = 7) %>%
  step_epi_naomit()

wf <- epi_workflow(r, parsnip::linear_reg()) %>% fit(jhu)

f <- frosting() %>%
  layer_predict() %>%
  layer_naomit(.pred)

wf1 <- wf %>% add_frosting(f)

p <- forecast(wf1)
p

cmu-delphi/epipredict documentation built on March 5, 2025, 12:17 p.m.