Support allocation scoring via forecast_allocation class
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reading the allocation scoring discussion in #1069 and the related variogram implementation in #1111, then compare the proposed constructor and metrics with scoringutils conventions. Resolve the open design questions before implementing as_forecast_allocation(), gpl_loss(), and gpl_regret(); done means pre-computed allocations can be scored and summarised through the stated workflow.
Written by the indexing model from the issue text.
Description
Summary
Add a forecast_allocation class to support scoring of resource allocation forecasts using generalised piecewise linear (GPL) loss functions, complementing the allocation scoring framework in the alloscore package (Gerding et al.).
Motivation
Allocation scoring (Gerding et al., 2023) evaluates forecasts through the lens of constrained resource allocation.
The central question is whether a forecast leads to good resource allocation decisions when a decision-maker must distribute a limited budget K across targets (e.g. locations).
This is directly relevant to public health forecasting (distributing vaccines, antivirals, hospital beds across regions) and was discussed in #1069 alongside the variogram score.
The alloscore package implements both the optimisation step (finding optimal allocations from forecast distributions) and the scoring step (evaluating allocations against outcomes).
This proposal covers only the scoring step in scoringutils, with alloscore handling the optimisation.
Reference: Gerding, A., Reich, N.G., Rogers, B. and Ray, E.L. (2023). Evaluating infectious disease forecasts with allocation scoring rules. arXiv:2312.16201
Proposed design
New class: forecast_allocation
An allocation forecast stores, per target within an allocation group:
- The allocation amount (predicted)
- The observed demand (observed)
- GPL loss parameters for scoring
| Column | Type | Description |
|---|---|---|
observed |
numeric | Observed demand at this target |
predicted |
numeric | Allocated amount at this target |
.alloc_group_id |
any | Groups targets sharing a budget constraint |
K |
numeric | Total resource budget for this group |
kappa |
numeric | GPL scale parameter (default: 1) |
alpha |
numeric | GPL asymmetry parameter (default: 0.5) |
w |
numeric | Per-unit cost weight (default: 1) |
The .alloc_group_id column plays the same structural role as .mv_group_id in forecast_multivariate_sample.
Constructor
as_forecast_allocation(
data,
forecast_unit = NULL,
alloc_across = NULL, # columns defining what is allocated across
K = NULL, # column name (required)
kappa = NULL, # column name or default value
alpha = NULL # column name or default value
)
Scoring metrics
gpl_loss(): realised GPL loss summed within each allocation groupgpl_regret(): excess loss relative to oracle allocation with perfect foresight
User workflow
# User computes allocations via alloscore or their own method
# Then evaluates them in scoringutils:
forecast <- as_forecast_allocation(
allocation_data,
alloc_across = "location",
K = "K", alpha = "alpha"
)
scores <- score(forecast)
scores |> summarise_scores(by = "model")
Relationship to alloscore
This design complements alloscore rather than replacing it:
| Concern | alloscore | scoringutils |
|---|---|---|
| Compute optimal allocations from forecast distributions | Yes | No |
| Score pre-computed allocations against outcomes | Yes | Yes |
| Evaluation pipeline (summarise, compare, visualise) | Limited | Yes |
Generality
The design works for any constrained vector prediction problem with asymmetric loss, not just epidemic resource allocation.
Open questions
- Should
as_forecast_allocation()strictly requiresum(w * predicted) == Kor allow under-utilisation? - How to handle the
g(increment) function in GPL loss: support identity and log as built-in string options? - Should oracle computation live in scoringutils, or should users provide oracle scores from alloscore?
- Should GPL parameters be data columns, metric arguments via
purrr::partial(), or both?
Related issues
- #1069 (original variogram/allocation score discussion)
- #1111 (variogram score implementation)
This was opened by a bot. Please ping @seabbs for any questions.
- Dominant language
- R
- Stars
- 67
- Forks
- 24
- Avg merge
- 1h 24m
- Merged PRs (30d)
- 2
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from epiforecasts/scoringutils
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
epiforecasts/scoringutils#1264 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
epiforecasts/scoringutils#1265 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
epiforecasts/scoringutils#1260 ·
Maintainers usually reply within 1 day
-
Incorrect guidance in `NEWS.md` re `add_relative_skill()`?Possibly taken @nikosbosse claimed this 15 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
epiforecasts/scoringutils#1226 · 1 comment · 2 reactions ·
Maintainers usually reply within 1 day
-
get_pit_histogram(): unsorted breaks produce negative densities; num_bins = 1 returns an empty tablePossibly taken @nikosbosse claimed this 15 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
epiforecasts/scoringutils#1219 ·
Maintainers usually reply within 1 day
All issues in epiforecasts/scoringutils
Similar issues
-
data_bio2rarify - doc - dimensions wrongPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
leppott/BioMonTools#162 ·
-
publications
Difficulty 1/5 Under an hour Newbie friendliness 85/100
epiforecasts/epiforecasts.github.io#161 ·
Maintainers usually reply within 1 day
-
Label `{sas}` chunk source as `sas` instead of `txt`, so it gets syntax highlightingPossibly taken @michaelmayer2 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
microbiome/OMA#1031 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ThinkR-open/golem#1265 ·