Skip to content

Commit 97e6314

Browse files
Jingjing TangJingjing Tang
authored andcommitted
re-set training_end_date and default test dates
1 parent eb56faf commit 97e6314

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

backfill_corrections/delphiBackfillCorrection/R/constants.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ TAUS <- c(0.01, 0.025, 0.1, 0.25, 0.5, 0.75, 0.9, 0.975, 0.99)
33
REF_LAG <- 60
44
TEST_LAGS <- c(1:14, 21, 35, 51)
55
TRAINING_DAYS <- 270
6-
TESTING_WINDOW <- 14
6+
TESTING_WINDOW <- 1
77
LAG_WINDOW <- 5
88
LAMBDA <- 0.1
99
LAG_PAD <- 2

backfill_corrections/delphiBackfillCorrection/R/io.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ get_issue_date_range <- function(params) {
166166
# date t0 (t0 < TODAY), we will always need to train a new model based on
167167
# data t < t0.
168168
assert(
169-
result$training_end_date < min(params$test_dates),
169+
result$training_end_date <= min(params$test_dates),
170170
"training end date must be earlier than the earliest test date to produce valid predictions"
171171
)
172172

backfill_corrections/delphiBackfillCorrection/R/model.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ generate_filename <- function(indicator, signal,
286286
#'
287287
#' @template params-template
288288
get_training_date_range <- function(params) {
289-
default_end_date <- TODAY - params$testing_window - 1
289+
default_end_date <- TODAY - params$testing_window + 1
290290

291291
if (params$train_models) {
292292
if (params_element_exists_and_valid(params, "training_end_date")) {

backfill_corrections/delphiBackfillCorrection/R/utils.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ read_params <- function(path = "params.json", template_path = "params.json.templ
7474
if (!("ref_lag" %in% names(params))) {params$ref_lag <- REF_LAG}
7575
if (!("testing_window" %in% names(params))) {params$testing_window <- TESTING_WINDOW}
7676
if (!("test_dates" %in% names(params)) || length(params$test_dates) == 0) {
77-
start_date <- TODAY - params$testing_window
78-
end_date <- TODAY - 1
77+
start_date <- TODAY - params$testing_window + 1
78+
end_date <- TODAY
7979
params$test_dates <- seq(start_date, end_date, by="days")
8080
} else {
8181
if (length(params$test_dates) != 2) {

0 commit comments

Comments
 (0)