generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 188: Benchmark infection feedback performance (#189)
- Loading branch information
1 parent
2ffc708
commit 3affe45
Showing
22 changed files
with
544 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
output/benchmarking/latest_subset_forecasts_by_forecast_date.tsv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
forecast_date crps_hosp crps_ww bias_hosp bias_ww ae_hosp ae_ww wweval_commit_hash wwinference_version time_stamp | ||
2023-10-16 5.145227727175137 4.405852136963368 0.48245657894736843 0.45490394736842105 6.950701593150161 6.041583425908238 d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
2023-11-13 4.66700940996615 4.019961671884518 -0.3123618421052632 -0.22545263157894738 6.145553133172695 5.324888683286438 d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
2023-12-11 8.859086840566519 8.837148573389927 -0.5840236842105263 -0.511771052631579 11.50992521124024 11.344388151022924 d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
2024-01-08 17.39089396390878 15.609039964313409 0.25387105263157894 0.3958921052631579 22.182123575526884 20.51478614874109 d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
2024-02-05 3.324198357881111 5.079010312322833 0.26249342105263157 0.3663105263157895 4.572098587350526 7.344139936498404 d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
2024-03-04 3.279328388379696 4.706364986307469 0.49960394736842106 0.6323973684210527 4.718323317619102 6.606204242479576 d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
2023-10-16 5.874998928099601 4.842755313016674 0.4281315789473684 0.40362236842105265 8.202210281292677 6.916940992684773 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
2023-11-13 5.514058896168103 4.2595719435319985 -0.4940644736842105 -0.3491868421052632 7.648424162053213 5.968291847862045 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
2023-12-11 5.367768349490639 5.48631763373991 -0.34426973684210527 -0.20431052631578947 8.157250251202527 7.768904286971368 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
2024-01-08 35.16983309770466 35.53006450254746 0.5046828947368421 0.5802315789473684 44.28701944409863 45.39614861289537 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
2024-02-05 2.773028914102106 3.711888477140153 -0.07066578947368421 0.15726973684210527 3.12398987017981 5.094208909464286 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
2024-03-04 2.751103566063376 4.452629873235709 0.3015644736842105 0.4553171052631579 3.7821969793270878 6.373191104611754 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z |
12 changes: 6 additions & 6 deletions
12
output/benchmarking/latest_subset_forecasts_by_location.tsv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
crps_hosp crps_ww bias_hosp bias_ww ae_hosp ae_ww location wweval_commit_hash wwinference_version time_stamp | ||
1.0465392954054191 1.0437418123363529 -0.052574561403508774 -0.05236184210526316 1.430541441794062 1.4249102564297214 AK d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
11.624616908337584 11.001390757513024 0.23765679824561403 0.30562280701754385 15.2169931884645 14.921735155883097 MA d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
1.9743211076933298 1.7647838214371094 0.10642543859649123 0.11702741228070176 2.6690277913463327 2.360288987441267 NH d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
17.371192144075163 17.18502224109214 0.16711842105263158 0.24489583333333334 22.505788770781994 22.54254318981423 NJ d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
3.5381177843863316 4.552876071939314 0.0430734649122807 0.31171600877192984 4.9099199893294525 6.397181233712242 WA d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
7.110957447979565 7.109562940863587 0.10033991228070176 0.18538004385964912 9.346454236343268 9.529331764656112 all d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
0.9048110671853405 0.8654847567756644 -0.07057236842105263 -0.07581030701754386 1.2465896546056678 1.2173595112401607 AK 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
14.762354885967529 12.681244008639368 0.18578947368421053 0.30892434210526315 19.250396069656812 16.835413776804067 MA 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
2.100055219513157 1.6857065406611689 -0.036726973684210525 0.038880482456140356 2.984162257895195 2.31003750944109 NH 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
26.360153847097493 25.59449289371047 0.1790548245614035 0.2609703947368421 33.681565511153316 33.56127504975967 NJ 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
3.7482847732602225 7.7424282528899155 0.013604166666666669 0.3361546052631579 5.504862330150637 10.673985614829668 WA 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
9.575131958604748 9.713871290535318 0.05422982456140351 0.17382390350877194 12.533515164692325 12.919614292414932 all 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
crps_hosp crps_ww bias_hosp bias_ww ae_hosp ae_ww location wweval_commit_hash wwinference_version time_stamp | ||
1.0465392954054191 1.0437418123363529 -0.052574561403508774 -0.05236184210526316 1.430541441794062 1.4249102564297214 AK d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
0.9048110671853405 0.8654847567756644 -0.07057236842105263 -0.07581030701754386 1.2465896546056678 1.2173595112401607 AK 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
14.762354885967529 12.681244008639368 0.18578947368421053 0.30892434210526315 19.250396069656812 16.835413776804067 MA 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
2.100055219513157 1.6857065406611689 -0.036726973684210525 0.038880482456140356 2.984162257895195 2.31003750944109 NH 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
26.360153847097493 25.59449289371047 0.1790548245614035 0.2609703947368421 33.681565511153316 33.56127504975967 NJ 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
3.7482847732602225 7.7424282528899155 0.013604166666666669 0.3361546052631579 5.504862330150637 10.673985614829668 WA 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
9.575131958604748 9.713871290535318 0.05422982456140351 0.17382390350877194 12.533515164692325 12.919614292414932 all 11a9898 227-inf-feedback-posterior-mod-eta 2024-10-30T19:46:57Z | ||
1.0376521512900907 1.0118669366748054 -0.03699122807017543 -0.00765679824561403 1.4245526802625763 1.4264265157766278 AK 51ddee5 227-inf-feedback 2024-10-25T17:16:51Z | ||
24.626800317489625 19.49484775911998 0.2060657894736842 0.4117872807017544 30.689131156635455 24.78340014717931 MA 51ddee5 227-inf-feedback 2024-10-25T17:16:51Z | ||
2.9839338399865656 1.8872799196790224 -0.01010087719298246 0.04486293859649123 4.248055546108953 2.2765310519617756 NH 51ddee5 227-inf-feedback 2024-10-25T17:16:51Z | ||
50.50136383077716 41.39684785751621 0.1817642543859649 0.2782510964912281 62.26077007486285 51.60308220739496 NJ 51ddee5 227-inf-feedback 2024-10-25T17:16:51Z | ||
4.468227694679483 10.723086482359754 -0.01542543859649122 0.33135855263157893 6.534705999620968 14.01577203801786 WA 51ddee5 227-inf-feedback 2024-10-25T17:16:51Z | ||
16.723595566844583 14.902785791069954 0.0650625 0.2117206140350877 21.03144309149816 18.821042392066108 all 51ddee5 227-inf-feedback 2024-10-25T17:16:51Z | ||
1.0465392954054191 1.0437418123363529 -0.05257456140350877 -0.05236184210526316 1.430541441794062 1.4249102564297214 AK d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
11.624616908337584 11.001390757513024 0.23765679824561403 0.30562280701754385 15.2169931884645 14.921735155883097 MA d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
1.9743211076933298 1.7647838214371094 0.10642543859649123 0.11702741228070176 2.6690277913463327 2.360288987441267 NH d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
17.371192144075163 17.18502224109214 0.16711842105263158 0.24489583333333334 22.505788770781994 22.54254318981423 NJ d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
1.9743211076933296 1.7647838214371094 0.10642543859649124 0.11702741228070176 2.6690277913463327 2.360288987441267 NH d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
17.371192144075163 17.18502224109214 0.16711842105263158 0.24489583333333337 22.505788770781994 22.54254318981423 NJ d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
3.5381177843863316 4.552876071939314 0.0430734649122807 0.31171600877192984 4.9099199893294525 6.397181233712242 WA d23b28a v0.1.0 2024-10-24T17:48:21Z | ||
7.110957447979565 7.109562940863587 0.10033991228070176 0.18538004385964912 9.346454236343268 9.529331764656112 all d23b28a v0.1.0 2024-10-24T17:48:21Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Quick estimate of posterior parameters | ||
|
||
benchmark_config <- yaml::read_yaml(file.path( | ||
"input", "config", | ||
"eval", "benchmark_config.yaml" | ||
)) | ||
|
||
vars <- c("eta_sd", "inf_feedback") | ||
eta_sd_draws <- tibble::tibble() | ||
inf_feedback_draws <- tibble::tibble() | ||
|
||
for (i in seq_along(benchmark_config$forecast_date_hosp)) { | ||
this_location <- benchmark_config$location_hosp[i] | ||
this_forecast_date <- benchmark_config$forecast_date_hosp[i] | ||
this_scenario <- "no_wastewater" | ||
for (j in seq_along(vars)) { | ||
fp_var <- wweval::get_filepath(benchmark_config$output_dir, | ||
scenario = this_scenario, | ||
forecast_date = this_forecast_date, | ||
model_type = "hosp", | ||
location = this_location, | ||
output_type = vars[j], | ||
file_extension = "tsv" | ||
) | ||
|
||
these_var_draws <- readr::read_tsv(fp_var) | ||
var_draws <- these_var_draws |> | ||
dplyr::mutate( | ||
location = this_location, | ||
forecast_date = this_forecast_date | ||
) | ||
if (vars[j] == "eta_sd") { | ||
eta_sd_draws <- dplyr::bind_rows(eta_sd_draws, var_draws) | ||
} | ||
if (vars[j] == "inf_feedback") { | ||
inf_feedback_draws <- dplyr::bind_rows( | ||
inf_feedback_draws, | ||
var_draws | ||
) | ||
} | ||
} # end loop over vars | ||
} # end loop over forecast date-locations | ||
|
||
# Get empirical mean, sd, logmean, and logsd------------------------------ | ||
## eta_sd--------------------------------------------------------------- | ||
mean_eta_sd <- mean(eta_sd_draws$eta_sd) | ||
sd_eta_sd <- sd(eta_sd_draws$eta_sd) | ||
|
||
message("Empirical mean of RW step size across 5 locations: ", mean_eta_sd) | ||
message("Empirical sd of RW step size across 5 locations: ", sd_eta_sd) | ||
|
||
## inf_feedback---------------------------------------------------------- | ||
logmean_inf_feedback <- mean(log(inf_feedback_draws$infection_feedback)) | ||
logsd_inf_feedback <- sd(log(inf_feedback_draws$infection_feedback)) | ||
|
||
|
||
message( | ||
"Empirical logmean of infection feedback across 5 locations: ", | ||
logmean_inf_feedback | ||
) | ||
message( | ||
"Empirical logsd of infection feedback across 5 locations: ", | ||
logsd_inf_feedback | ||
) | ||
|
||
posterior_params <- list( | ||
mean_eta_sd = mean_eta_sd, | ||
sd_eta_sd = sd_eta_sd, | ||
logmean_inf_feedback = logmean_inf_feedback, | ||
logsd_inf_feedback = logsd_inf_feedback | ||
) | ||
yaml::write_yaml(posterior_params, "output/posterior_params.yaml") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.