@@ -79,23 +79,26 @@ apply_frosting.default <- function(workflow, components, ...) {
79
79
# ' @export
80
80
apply_frosting.epi_workflow <- function (workflow , components , the_fit , ... ) {
81
81
if (! has_postprocessor(workflow )) {
82
- components $ preds <- predict(the_fit , components $ forged $ predictors , ... )
82
+ components $ predictions <- predict(the_fit , components $ forged $ predictors , ... )
83
+ components $ predictions <- dplyr :: bind_cols(components $ keys , components $ predictions )
83
84
return (components )
84
85
}
85
86
if (! has_postprocessor_frosting(workflow )) {
86
87
rlang :: warn(c(" Only postprocessors of class frosting are allowed." ,
87
88
" Returning unpostprocessed predictions." ))
88
- components $ preds <- predict(the_fit , components $ forged $ predictors , ... )
89
+ components $ predictions <- predict(the_fit , components $ forged $ predictors , ... )
90
+ components $ predictions <- dplyr :: bind_cols(components $ keys , components $ predictions )
89
91
return (components )
90
92
}
91
- layers <- workflow $ post $ actions $ frosting $ frosting
92
- for (l in seq_along(layers $ layers )) {
93
- layer <- layers $ layers [[l ]]
94
- components <- slather(layer , components = components , the_fit )
93
+ layers <- workflow $ post $ actions $ frosting $ frosting $ layers
94
+ for (l in seq_along(layers )) {
95
+ la <- layers [[l ]]
96
+ components <- slather(la , components = components , the_fit )
95
97
}
96
98
# last for the moment, anticipating that layer[1] will do the prediction...
97
- if (is_null(components $ preds )) {
98
- components $ preds <- predict(the_fit , components $ forged $ predictors , ... )
99
+ if (is_null(components $ predictions )) {
100
+ components $ predictions <- predict(the_fit , components $ forged $ predictors , ... )
101
+ components $ predictions <- dplyr :: bind_cols(components $ keys , components $ predictions )
99
102
}
100
103
return (components )
101
104
}
0 commit comments