Skip to content

Commit 70d8e35

Browse files
dsweber2dshemetov
andauthored
Add investigation of decreasing forecaster behavior (#195)
Co-authored-by: Dmitry Shemetov <[email protected]>
1 parent 6934a1e commit 70d8e35

File tree

6 files changed

+913
-55
lines changed

6 files changed

+913
-55
lines changed

.github/workflows/tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
- name: System dependencies
4040
run: |
41-
sudo apt-get update && sudo apt-get -y install libglpk-dev
41+
sudo apt-get update && sudo apt-get -y install libglpk-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev
4242
4343
- uses: r-lib/actions/setup-renv@v2
4444

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ data/
2222
.nhsn_covid_cache.parquet
2323
.nhsn_flu_cache.parquet
2424
meta/
25+
**/unnamed-chunk*
26+
decreasing_forecasters_cache/

R/forecasters/forecaster_scaled_pop_seasonal.R

+6-3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ scaled_pop_seasonal <- function(epi_data,
5252
quantile_levels = covidhub_probs(),
5353
filter_source = "",
5454
filter_agg_level = "",
55+
clip_lower = TRUE,
5556
...) {
5657
scale_method <- arg_match(scale_method)
5758
center_method <- arg_match(center_method)
@@ -92,7 +93,7 @@ scaled_pop_seasonal <- function(epi_data,
9293
}
9394
args_input[["ahead"]] <- ahead
9495
args_input[["quantile_levels"]] <- quantile_levels
95-
args_input[["nonneg"]] <- scale_method == "none"
96+
args_input[["nonneg"]] <- if (!is.null(args_input[["nonneg"]])) args_input[["nonneg"]] else scale_method == "none"
9697
args_input[["seasonal_window"]] <- "window" %in% seasonal_method
9798
args_input[["seasonal_backward_window"]] <- seasonal_backward_window
9899
args_input[["seasonal_forward_window"]] <- seasonal_forward_window + ahead
@@ -228,8 +229,10 @@ scaled_pop_seasonal <- function(epi_data,
228229
pred_final <- pred %>%
229230
rename({{ outcome }} := value) %>%
230231
data_coloring(outcome, learned_params, join_cols = key_colnames(epi_data, exclude = "time_value"), nonlin_method = nonlin_method) %>%
231-
rename(value = {{ outcome }}) %>%
232-
mutate(value = pmax(0, value))
232+
rename(value = {{ outcome }})
233+
if (clip_lower) {
234+
pred_final %<>% mutate(value = pmax(0, value))
235+
}
233236
if (adding_source) {
234237
pred_final %<>% select(-source)
235238
}

renv.lock

+2-50
Original file line numberDiff line numberDiff line change
@@ -7413,56 +7413,8 @@
74137413
},
74147414
"renv": {
74157415
"Package": "renv",
7416-
"Version": "1.1.3",
7417-
"Source": "Repository",
7418-
"Type": "Package",
7419-
"Title": "Project Environments",
7420-
"Authors@R": "c( person(\"Kevin\", \"Ushey\", role = c(\"aut\", \"cre\"), email = \"[email protected]\", comment = c(ORCID = \"0000-0003-2880-7407\")), person(\"Hadley\", \"Wickham\", role = c(\"aut\"), email = \"[email protected]\", comment = c(ORCID = \"0000-0003-4757-117X\")), person(\"Posit Software, PBC\", role = c(\"cph\", \"fnd\")) )",
7421-
"Description": "A dependency management toolkit for R. Using 'renv', you can create and manage project-local R libraries, save the state of these libraries to a 'lockfile', and later restore your library as required. Together, these tools can help make your projects more isolated, portable, and reproducible.",
7422-
"License": "MIT + file LICENSE",
7423-
"URL": "https://rstudio.github.io/renv/, https://github.com/rstudio/renv",
7424-
"BugReports": "https://github.com/rstudio/renv/issues",
7425-
"Imports": [
7426-
"utils"
7427-
],
7428-
"Suggests": [
7429-
"BiocManager",
7430-
"cli",
7431-
"compiler",
7432-
"covr",
7433-
"cpp11",
7434-
"devtools",
7435-
"gitcreds",
7436-
"jsonlite",
7437-
"jsonvalidate",
7438-
"knitr",
7439-
"miniUI",
7440-
"modules",
7441-
"packrat",
7442-
"pak",
7443-
"R6",
7444-
"remotes",
7445-
"reticulate",
7446-
"rmarkdown",
7447-
"rstudioapi",
7448-
"shiny",
7449-
"testthat",
7450-
"uuid",
7451-
"waldo",
7452-
"yaml",
7453-
"webfakes"
7454-
],
7455-
"Encoding": "UTF-8",
7456-
"RoxygenNote": "7.3.2",
7457-
"VignetteBuilder": "knitr",
7458-
"Config/Needs/website": "tidyverse/tidytemplate",
7459-
"Config/testthat/edition": "3",
7460-
"Config/testthat/parallel": "true",
7461-
"Config/testthat/start-first": "bioconductor,python,install,restore,snapshot,retrieve,remotes",
7462-
"NeedsCompilation": "no",
7463-
"Author": "Kevin Ushey [aut, cre] (<https://orcid.org/0000-0003-2880-7407>), Hadley Wickham [aut] (<https://orcid.org/0000-0003-4757-117X>), Posit Software, PBC [cph, fnd]",
7464-
"Maintainer": "Kevin Ushey <[email protected]>",
7465-
"Repository": "RSPM"
7416+
"Version": "1.1.4",
7417+
"Source": "Repository"
74667418
},
74677419
"reprex": {
74687420
"Package": "reprex",

renv/activate.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
local({
33

44
# the requested version of renv
5-
version <- "1.1.3"
5+
version <- "1.1.4"
66
attr(version, "sha") <- NULL
77

88
# the project directory

0 commit comments

Comments
 (0)