Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive Weighting Function #8

Open
yijunwang0805 opened this issue Aug 24, 2020 · 1 comment
Open

Adaptive Weighting Function #8

yijunwang0805 opened this issue Aug 24, 2020 · 1 comment

Comments

@yijunwang0805
Copy link

Hi,

Thank you for your wonderful package!

In Brooks' 2018 paper "Nonmechanistic forecasts of seasonal influenza with iterative one-week-ahead distributions" and 2020 "Pancasting: forecasting epidemics from provisional data", he mentioned that he uses an adaptive weighting/ a stacking approach to ensemble the forecast models.

I looked through the manual epiforecast 0.0.1 but could not find the function for adaptive weighting. Could you please shed some light on it?

Best regards,
Yijun

@brookslogan
Copy link
Contributor

natreg-forecasts.R provides an (involved) example of forming adaptively weighted ensembles like those in the paper. In natreg-config.R you can see references to a few types that are compared:

e.ensemble.partial.weighting.scheme.wgt.indexer.lists = list(  ## "constant-weights" = list(all=NULL, all=NULL, all=NULL),  "target-based" = list(all=NULL, all=NULL, each=NULL),  "target-3time-based" = list(smear=-1:1, all=NULL, each=NULL),  "target-9time-based" = list(smear=-4:4, all=NULL, each=NULL)) %>>% with_dimnamesnames("Ensemble weighting scheme")

The wgt part refers to the fact that the elements of these partial CV indexer lists refer to the week of the season, "epigroup" (in this setup, this refers to the location), and the target being modeled. Here, target-based fits an ensemble based on all weeks of season from all locations for each target separately, while target-9time-based considers only data from up to 4 weeks away (smear=-4:4), from all locations (all=NULL), for each target separately (each=NULL), the RelevanceWeight scheme used in the paper (weights are always fit separately for different metrics in these scripts --- each=NULL is added later).

As a warning, cv_apply is a currently a bit rigid and awkward to use (and needs examples), so it may not be the best for experimentation with new weighting schemes. In particular, assigning a gradation of weights rather than just picking out certain instances to train on, as well as dealing with potentially-missing training instances, will require extra coding effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants