`score()`, `scores` objects and `summarise_scores()`: metric names, `...`, lost attributes

Open
#1,268 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
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
r
Domain
data

Research direction

Start by reading the implementations of score(), the scores methods for merge() and rbind(), summarise_scores(), and get_metrics(); the issue does not name file paths or tests. Reproduce the listed cases in the package and trace which behaviors each function currently supports. Done means the reported data loss, inconsistent argument handling, and summary and selection failures are addressed, with tests covering each case.

Written by the indexing model from the issue text.

Description

CLAUDE: - [ ] Duplicate metric names silently drop the second metric. score(x, metrics = list(m = crps_sample, m = mad_sample)) computes only the first and returns attr(, "metrics") of c("m", "m"). Suggestion: require unique names.

  • A metric named like a column is lost or overwrites the column. A metric called observed is announced as overwriting and then deleted; a metric called model replaces the model column with numbers. Suggestion: abort on such clashes.
  • ... in score() is forwarded to the metrics for nominal and ordinal forecasts, and silently ignored for all other types. The documentation says it is unused. Make this consistent and warn when arguments are ignored.
  • A metric returning the wrong length is recycled silently (length 1) or makes the whole score() call fail (other lengths), because the assignment is outside run_safely().
  • merge() and rbind() on scores lose the metrics attribute (merge() even keeps the class), so summarise_scores() and get_pairwise_comparisons() then fail with "Input needs an attribute metrics". Attaching model metadata with merge() is a common workflow.
  • summarise_scores(): writes back the stale metrics attribute; by = NULL / character(0) errors, so there is no overall summary; a fun returning more than one value produces several unlabelled rows per group.
  • get_metrics(): no default method; get_metrics.scores() silently ignores select / exclude.

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.