Skip to content

Commit

Permalink
Merge pull request #211 from signaturescience/dev
Browse files Browse the repository at this point in the history
v2.0.2 release
  • Loading branch information
vpnagraj authored May 5, 2024
2 parents 75c5fbe + 44704f3 commit cf16d54
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: fiphde
Title: Forecasting Influenza in Support of Public Health Decision Making
Version: 2.0.1
Version: 2.0.2
Authors@R:
c(person(given = "VP",
family = "Nagraj",
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# fiphde 2.0.2

## New features

### NNETAR in ensemble

As of this release, if the NNETAR model is specified in the `ts_fit_forecast()` function (i.e., "nnetar" is not `NULL` in the model list) then the model will be included in the ensemble. In previous releases, if the NNETAR method was used the results would be included in the returned forecast and fit objects but would not be ensembled with the other components. Note that currently *all* of the possible models (ARIMA, ETS, and NNETAR) must be specified to use the NNETAR in the ensemble.

# fiphde 2.0.1

## Bug fixes
Expand Down
1 change: 1 addition & 0 deletions R/fiphde-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,6 @@ if(getRversion() >= "2.15.1") utils::globalVariables(c(".",
"reference_date",
"target_name",
"target_prob",
"nnetar",
"."))

11 changes: 7 additions & 4 deletions R/forecast.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,13 @@ ts_fit_forecast <- function(prepped_tsibble,
# e.g. if an ARIMA model doesn't fit for one location but the ETS does, you still want the ETS model for that location.
tsfit <- purrr::reduce(tsfit, dplyr::inner_join, by="location")

# Ensemble the ARIMA and ETS models
# Hard-coded for now - can always ensemble other models if/when we add them.
# fixme: this could be more flexible
if (ensemble & !is.null(models$arima) & !is.null(models$ets)) {
# Ensemble the models
# TODO: make this more flexible and not hard-coded in the future?
if (ensemble & !is.null(models$arima) & !is.null(models$ets) & !is.null(models$nnetar)) {
tsfit <-
tsfit %>%
dplyr::mutate(ensemble=(arima+ets+nnetar)/3)
} else if (ensemble & !is.null(models$arima) & !is.null(models$ets)) {
tsfit <-
tsfit %>%
dplyr::mutate(ensemble=(arima+ets)/2)
Expand Down

0 comments on commit cf16d54

Please sign in to comment.