@@ -52,16 +52,20 @@ four_week_ahead$epi_workflow
52
52
53
53
# Anatomy of an ` epi_workflow `
54
54
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 .
58
58
59
59
### Preprocessor
60
60
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.
62
62
Transformations can include converting counts to rates, applying a running average
63
63
to columns, or [ any of the ` step ` s found in ` {recipes} ` ] ( https://recipes.tidymodels.org/reference/index.html ) .
64
64
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.
65
69
You can think of a preprocessor as a more flexible ` formula ` that you would pass to ` lm() ` : ` y ~ x1 + log(x2) + lag(x1, 5) ` .
66
70
The simple model above internally runs 6 of these steps, such as creating lagged predictor columns.
67
71
@@ -88,14 +92,19 @@ However, the _main_ mechanism we rely on to prevent data leakage is proper
88
92
89
93
### Trainer
90
94
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.
92
96
Examples include linear regression, quantile regression, or [ any ` {parsnip} ` engine] ( https://www.tidymodels.org/find/parsnip/ ) .
93
97
The ` {parsnip} ` front-end abstracts away the differences in interface between a wide collection of statistical models.
94
98
99
+ All workflows must include a model.
100
+
95
101
### Postprocessor
96
102
97
103
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.
99
108
100
109
Each operation within a postprocessor is called a "layer" (functions are named ` layer_* ` ), and the stack of layers is known as ` frosting() ` ,
101
110
continuing the metaphor of baking a cake established in ` {recipes} ` .
0 commit comments