`filter_scores()`, `impute_missing_scores()`, `transform_forecasts()`, `get_coverage()`: edge cases

Open
#1,272 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
r
Domain
testing-qa

Research direction

Start by reading the implementations and tests for filter_scores(), impute_missing_scores(), transform_forecasts(), get_coverage(), and log_shift(), then inspect the “Handling missing forecasts” vignette. Reproduce the listed edge cases and check how existing tests cover them. Done means the identified input, validation, output, interface, and vignette issues are addressed and regression coverage confirms the expected behavior.

Written by the indexing model from the issue text.

Description

CLAUDE: - [ ] compare is not checked against the forecast unit in filter_scores() and impute_missing_scores(): filter_scores(scores, compare = "wis") removes every row with only an info message; NA in the compare column is treated as a comparator and gets imputed rows.

  • Summarised scores are accepted: imputing then mixes levels of aggregation, and filter_scores() on scores summarised by model fails with a raw data.table error.
  • The default log transform on counts with zeros makes score() drop bias for the whole data set (natural scale included): zero quantiles become -Inf and bias_quantile() fails on diff() of infinite values. The validation inside transform_forecasts() is wrapped in suppressWarnings(suppressMessages()), so nothing reports the infinite values.
  • transform_forecasts() accepts binary, nominal and ordinal forecasts and applies fun to probabilities and factor observations.
  • log_shift() checks the input before applying the offset (log_shift(-0.5, offset = 1) aborts) and accepts base = 0 and base = 1.
  • get_coverage() gives two values for one interval when a forecast lacks one bound: the row of the lower quantile level is NA, the row of the upper level a number.
  • Sample PIT bin labels are [a,b) but values are binned right-closed.
  • Interface: get_pit_histogram() has no default for by (get_coverage() has); impute_model_score(model = ) is named model although compare can be any column; filter_scores() returns a keyed, re-sorted table; label in transform_forecasts() is documented as only relevant for append = TRUE but is also used otherwise.
  • Vignette "Handling missing forecasts": the explanation of why thresholds between 0.75 and 1 behave alike is wrong (9 death targets are covered by exactly three models); the conclusion is right.

Found during a full review of the package (version 2.3.0.9000, main at 779d7d68).

Dominant language
R
Stars
67
Forks
24
Avg merge
1h 24m
Merged PRs (30d)
2

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from epiforecasts/scoringutils

All issues in epiforecasts/scoringutils

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.