Skip to content

Commit 5469dda

Browse files
nmdefriesdsweber2
authored andcommitted
add alternate step names and say if optional/not
1 parent 3aad6b8 commit 5469dda

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

vignettes/custom_epiworkflows.Rmd

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,20 @@ four_week_ahead$epi_workflow
5252

5353
# Anatomy of an `epi_workflow`
5454

55-
An `epi_workflow()` is an extension of a `workflows::workflow()` that handles panel
56-
data and post-processing.
57-
All `epi_workflows`, including simple and canned workflows, consist of 3 components.
55+
An `epi_workflow()` is an extension of a `workflows::workflow()` that is specially designed to handle panel
56+
data, and to apply custom post-processing steps to the output of a model.
57+
All `epi_workflows`, including simple and canned workflows, consist of 3 components, a preprocessor, trainer, and postprocessor.
5858

5959
### Preprocessor
6060

61-
A preprocessor transforms the data before model training and prediction.
61+
A preprocessor (also called a recipe) transforms the data before model training and prediction.
6262
Transformations can include converting counts to rates, applying a running average
6363
to columns, or [any of the `step`s found in `{recipes}`](https://recipes.tidymodels.org/reference/index.html).
6464

65+
All workflows must include a preprocessor.
66+
The most basic preprocessor just assigns roles to columns, telling the model in the next step which to use as predictors or the outcome.
67+
68+
However, preprocessors can do much more.
6569
You can think of a preprocessor as a more flexible `formula` that you would pass to `lm()`: `y ~ x1 + log(x2) + lag(x1, 5)`.
6670
The simple model above internally runs 6 of these steps, such as creating lagged predictor columns.
6771

@@ -88,14 +92,19 @@ However, the _main_ mechanism we rely on to prevent data leakage is proper
8892

8993
### Trainer
9094

91-
A trainer fits a `{parsnip}` model on data, and outputs a fitted model object.
95+
A trainer (aso called a model or engine) fits a `{parsnip}` model on data, and outputs a fitted model object.
9296
Examples include linear regression, quantile regression, or [any `{parsnip}` engine](https://www.tidymodels.org/find/parsnip/).
9397
The `{parsnip}` front-end abstracts away the differences in interface between a wide collection of statistical models.
9498

99+
All workflows must include a model.
100+
95101
### Postprocessor
96102

97103
Postprocessors are unique to `{epipredict}`.
98-
A postprocessor modifies and formats the prediction after a model has been fit.
104+
A postprocessor (also known as frosting) modifies and formats the prediction after a model has been fit.
105+
106+
The postprocessor is _optional_.
107+
It only needs to be included in a workflow if you need to process the model output.
99108

100109
Each operation within a postprocessor is called a "layer" (functions are named `layer_*`), and the stack of layers is known as `frosting()`,
101110
continuing the metaphor of baking a cake established in `{recipes}`.

0 commit comments

Comments
 (0)