@@ -35,13 +35,13 @@ tar_option_set(
35
35
source(" covid_hosp_explore/forecaster_instantiation.R" )
36
36
source(" covid_hosp_explore/data_targets.R" )
37
37
38
- forecasts_and_scores_separate_aheads <- tar_map(
38
+ forecasts_and_scores_by_ahead <- tar_map(
39
39
values = forecaster_param_grids ,
40
40
names = id ,
41
41
unlist = FALSE ,
42
- tar_target (
43
- name = forecast_by_ahead ,
44
- command = {
42
+ tar_target_raw (
43
+ name = ONE_AHEAD_FORECAST_NAME ,
44
+ command = expression(
45
45
forecaster_pred(
46
46
data = joined_archive_data_2022 ,
47
47
outcome = " hhs" ,
@@ -52,11 +52,11 @@ forecasts_and_scores_separate_aheads <- tar_map(
52
52
forecaster_args = params ,
53
53
forecaster_args_names = param_names
54
54
)
55
- }
55
+ )
56
56
),
57
- tar_target (
58
- name = score_by_ahead ,
59
- command = {
57
+ tar_target_raw (
58
+ name = ONE_AHEAD_SCORE_NAME ,
59
+ command = expression(
60
60
run_evaluation_measure(
61
61
data = forecast_by_ahead ,
62
62
evaluation_data = hhs_evaluation_data ,
@@ -66,7 +66,7 @@ forecasts_and_scores_separate_aheads <- tar_map(
66
66
ic80 = interval_coverage(0.8 )
67
67
)
68
68
)
69
- }
69
+ )
70
70
)
71
71
)
72
72
@@ -87,24 +87,6 @@ forecasts_and_scores <- tar_map(
87
87
mutate(parent_forecaster = parent_id )
88
88
}
89
89
)
90
- # tar_target(
91
- # name = score,
92
- # command = {
93
- # bind_rows(!!!component_ids) %>%
94
- # mutate(parent_forecaster = parent_id)
95
- # }
96
- # )
97
- # ,
98
- # tar_combine(
99
- # name = score,
100
- # list(
101
- # forecasts_and_scores_separate_aheads[["score_by_ahead"]][filter(param_grid, parent_id == value)[["rownum"]]]
102
- # ),
103
- # command = {
104
- # bind_rows(!!!.x) %>%
105
- # mutate(parent_forecaster = name)
106
- # }
107
- # )
108
90
)
109
91
110
92
ensemble_keys <- list (a = c(300 , 15 ))
@@ -126,8 +108,8 @@ ensemble_forecast <- tar_map(
126
108
name = ensemble_forecast ,
127
109
# TODO: Needs a lookup table to select the right forecasters
128
110
list (
129
- forecasts_and_scores_separate_aheads [[" forecast_by_ahead" ]][[1 ]],
130
- forecasts_and_scores_separate_aheads [[" forecast_by_ahead" ]][[2 ]]
111
+ forecasts_and_scores_by_ahead [[" forecast_by_ahead" ]][[1 ]],
112
+ forecasts_and_scores_by_ahead [[" forecast_by_ahead" ]][[2 ]]
131
113
),
132
114
command = {
133
115
bind_rows(!!! .x , .id = " forecaster" ) %> %
@@ -161,7 +143,7 @@ ensemble_forecast <- tar_map(
161
143
list (
162
144
data ,
163
145
forecasters ,
164
- forecasts_and_scores_separate_aheads ,
146
+ forecasts_and_scores_by_ahead ,
165
147
forecasts_and_scores ,
166
148
ensembles ,
167
149
ensemble_forecast
0 commit comments