Skip to content

Commit 7aee9bd

Browse files
authored
minor: small comment cleanup and test import changes (#184)
1 parent 7c32854 commit 7aee9bd

12 files changed

+11
-11
lines changed

R/forecasters/forecaster_flusion.R

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ flusion <- function(epi_data,
6262
args_list <- do.call(default_args_list, args_input)
6363
# if you want to hardcode particular predictors in a particular forecaster
6464
predictors <- c(outcome, extra_sources)
65-
# TODO: Partial match quantile_level coming from here (on Dmitry's machine)
6665
c(args_list, predictors, trainer) %<-% sanitize_args_predictors_trainer(epi_data, outcome, predictors, trainer, args_list)
6766
# end of the copypasta
6867
# finally, any other pre-processing (e.g. smoothing) that isn't performed by

R/forecasters/forecaster_scaled_pop_seasonal.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ scaled_pop_seasonal <- function(epi_data,
109109
# end of the copypasta
110110

111111
# whiten to get the sources on the same scale
112-
# TODO Jank way to avoid having hhs_region get centered
113112
# finally, any other pre-processing (e.g. smoothing) that isn't performed by
114113
# epipredict
115114
if (drop_non_seasons) {
116115
season_data <- epi_data %>% drop_non_seasons()
117116
} else {
118117
season_data <- epi_data
119118
}
119+
# TODO: Jank way to avoid having hhs_region get centered; this isn't very general
120120
learned_params <- calculate_whitening_params(season_data, setdiff(predictors, "hhs_region"), scale_method, center_method, nonlin_method)
121121
epi_data %<>% data_whitening(setdiff(predictors, "hhs_region"), learned_params, nonlin_method)
122122

R/targets/covid_external_targets.R

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ create_covid_external_targets <- function() {
3232
# Filter to only forecasts we care about.
3333
filter(forecast_date %in% (forecast_dates + g_time_value_adjust)) %>%
3434
mutate(target_end_date = as.Date(forecast_date) + 7 * as.numeric(ahead)) %>%
35+
# TODO: A very rough adjustment to get daily counts on the same scale
36+
# as weekly counts.
3537
mutate(prediction = prediction * 7)
3638
}
3739
),

R/targets/shared_utils.R

-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ create_forecast_targets <- function() {
9696
# Push the Wednesday markers to Saturday, to match targets with truth data.
9797
mutate(forecast_date = forecast_date + g_time_value_adjust, target_end_date = target_end_date + g_time_value_adjust) %>%
9898
rename("model" = "id")
99-
# browser()
10099
evaluate_predictions(forecasts = forecast_scaled, truth_data = hhs_evaluation_data) %>%
101100
rename("id" = "model")
102101
}

tests/testthat/test-daily-weekly-archive.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source(here::here("R", "load_all.R"))
1+
suppressPackageStartupMessages(source(here::here("R", "load_all.R")))
22

33
# Works correctly if you have exactly one version where the previous Friday data
44
# is the latest so it is ignored and the week before THAT is summed (10-27 to

tests/testthat/test-data-whitening.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source(here::here("R", "load_all.R"))
1+
suppressPackageStartupMessages(source(here::here("R", "load_all.R")))
22
real_ex <- epidatasets::covid_case_death_rates %>%
33
as_tibble() %>%
44
mutate(source = "same") %>%

tests/testthat/test-forecaster-utils.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source(here::here("R", "load_all.R"))
1+
suppressPackageStartupMessages(source(here::here("R", "load_all.R")))
22

33
test_that("sanitize_args_predictors_trainer", {
44
epi_data <- epidatasets::covid_case_death_rates

tests/testthat/test-forecasters-basics.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source(here::here("R", "load_all.R"))
1+
suppressPackageStartupMessages(source(here::here("R", "load_all.R")))
22
testthat::local_edition(3)
33
# TODO better way to do this than copypasta
44
forecasters <- list(

tests/testthat/test-forecasters-data.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source(here::here("R", "load_all.R"))
1+
suppressPackageStartupMessages(source(here::here("R", "load_all.R")))
22

33
testthat::skip("Optional, long-running tests skipped.")
44

tests/testthat/test-latency_adjusting.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source(here::here("R", "load_all.R"))
1+
suppressPackageStartupMessages(source(here::here("R", "load_all.R")))
22

33
test_that("extend_ahead", {
44
# testing that POSIXct converts correctly (as well as basic types)

tests/testthat/test-step-training-window.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source(here::here("R", "load_all.R"))
1+
suppressPackageStartupMessages(source(here::here("R", "load_all.R")))
22

33
data <- tribble(
44
~geo_value, ~time_value, ~version, ~value,

tests/testthat/test-transforms.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source(here::here("R", "load_all.R"))
1+
suppressPackageStartupMessages(source(here::here("R", "load_all.R")))
22

33
n_days <- 20
44
removed_date <- 10

0 commit comments

Comments
 (0)