Nominal, ordinal and multivariate forecasts: validation gaps

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
r
Domain
data

Research direction

Start by reading assert_forecast() and the existing grouping validation, then inspect set_grouping(), transform_forecasts(), and the nominal, ordinal, and multivariate metric construction paths. Reproduce the reported cases with the package’s forecast examples and tests. Done means invalid probabilities and group IDs are rejected or handled correctly, singleton and varying-size groups behave as intended, and the listed documentation errors are corrected.

Written by the indexing model from the issue text.

Description

CLAUDE: - [ ] One NA probability makes the metric fail for every nominal / ordinal forecast. After NA removal one forecast has fewer probabilities, rbind() recycles that row, the sum-to-one check fails and the metric is dropped for the whole data set. If the recycled row happens to sum to 1 the result would be silently wrong.

  • Probabilities outside [0, 1] or not summing to 1 are not checked at construction, only inside the metric, where one bad forecast removes the metric for all forecasts.
  • A user-supplied .mv_group_id is not validated: a character column builds a valid object but both multivariate metrics then fail; nothing checks that a group does not span several models.
  • set_grouping() loops over all groups and subsets the whole table each time: about 4 s for 5,000 groups of 2 members with 10 samples. The equivalent vectorised check already exists in assert_forecast().
  • transform_forecasts() fails for multivariate forecasts whose groups all have one member, because joint_across is reconstructed from the data. Storing joint_across as an attribute would also help #1183.
  • Groups of different sizes are accepted silently; a single-member group always has a variogram score of 0, and a fixed w_vs can only fit some groups.
  • Documentation: as_forecast_multivariate_sample() @returns names the class forecast_sample; the ordinal get_metrics() method is titled "for nominal forecasts"; example_nominal / example_ordinal document observed as numeric.

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.