Univariate metrics: edge cases in PIT, integer detection, interval coverage and input checks

Aperta
#1,271 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
r
Ambito
data

Direzione di ricerca

Start by reading the affected metric implementations and their tests in the scoringutils package, especially pit_histogram_sample(), get_type(), interval_coverage(), logs_binary(), and the quantile and point metric functions. Reproduce the listed examples and check existing tests for input validation, missing values, and matrix outputs. Done means the reported edge cases have consistent, tested behavior across the affected metrics.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

CLAUDE: - [ ] The randomised PIT uses one uniform draw per replicate for all forecasts (runif(1)); Czado et al. (2009) use an independent draw per forecast. With few replicates the histogram of a calibrated forecast looks miscalibrated.

P <- matrix(rep(0:9, 100), 100, byrow = TRUE); set.seed(1)
pit_histogram_sample(rep(5, 100), P, seq(0, 1, 0.01)[c(1, 51:61, 101)],
                     integers = "random", n_replicates = 1)
#> 0 0 0 100 0 0 0 0 0 0 0 0
  • get_type() uses a relative tolerance, so continuous samples around 1e8 are classified as integer and bias_sample() uses the integer formula (bias_sample(1e8 + 0.5, matrix(1e8 + runif(200), 1)) is about 0.5 rather than about 0). Values above 2^31 warn ("NAs introduced by coercion to integer range"). Suggestion: all(x == round(x)).
  • interval_coverage() returns logical(0) for interval ranges that are not round numbers, e.g. interval_range = 100 / 3 with levels 1/3 and 2/3, because one comparison is rounded and the other is not.
  • NA in quantile_level is accepted and handled differently by each metric (quantile_score() gives NA, bias_quantile() a value, wis() an error).
  • logs_binary() loses precision: -log(1 - abs(observed - predicted)) returns Inf for p = 1e-17 where 39.1 is correct.
  • na.rm is inconsistent: wis() defaults to FALSE, bias_quantile() to TRUE, other quantile metrics have no such argument; sample metrics differ in whether NA errors, gives NA, or is dropped.
  • Point metrics are unvalidated anonymous functions with the argument actual instead of observed; inputs recycle silently.
  • pit_histogram_sample() barely validates n_replicates and quantiles.
  • The default sample metrics include log_score, which warns for every integer-valued data set, including example_sample_discrete.
  • Binary metrics return a matrix when predicted is an n x 1 matrix.

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

Lingua principale
R
Stelle
65
Fork
24
Merge medio
1h 24m
PR unite (30g)
2

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di epiforecasts/scoringutils

Tutte le issue di epiforecasts/scoringutils

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.