Multivariate sample scores pair draws by row order, not by `sample_id`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 56/100
Línea de trabajo
Start with score.forecast_multivariate_sample() and compare its row-order pairing with the ordering used by the quantile, nominal, and ordinal scoring methods. Reproduce the issue with the supplied forecast and shuffled rows, then inspect assert_forecast() to understand its sample checks. Done means joint draws are paired by sample_id (or consistently ordered with mismatched ID sets rejected) and the example scores identically after row shuffling.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
as_forecast_multivariate_sample() takes a sample_id column, and a natural reading is that rows sharing a sample_id within a multivariate group form one joint draw. score() does not use it that way. In score.forecast_multivariate_sample(), the predictions for each forecast unit are collected in row order (predicted = list(predicted)), and the j-th prediction of every forecast unit in a group is treated as the same draw. sample_id is only used to count samples and to detect duplicates. So the same forecast gives a different score when its rows are in a different order.
Example: three draws that are joint across locations A and B. Each draw has the same value in both locations. Reversing the order of location B's rows changes the score, although the forecast is the same.
library(scoringutils)
# Three draws, each joint across locations A and B.
# Draw k has the same value in both locations.
forecast <- data.frame(
model = "m",
location = rep(c("A", "B"), each = 3),
sample_id = rep(1:3, times = 2),
observed = 10,
predicted = c(1, 10, 20, 1, 10, 20)
)
# The same rows, with location B's rows in reverse order.
shuffled <- forecast[c(1, 2, 3, 6, 5, 4), ]
score(as_forecast_multivariate_sample(forecast, joint_across = "location"))$energy_score
#> [1] 2.985562
score(as_forecast_multivariate_sample(shuffled, joint_across = "location"))$energy_score
#> [1] 2.993827
With the shuffled rows, the first draw is scored as (A = 1, B = 20) instead of (A = 1, B = 1). The marginal distributions are unchanged, but the dependence between locations is not the one the forecaster submitted. Nothing warns about it, so data that is not sorted by sample_id within each forecast unit is silently scored as a different forecast.
The quantile, nominal and ordinal methods already order predictions by quantile_level or predicted_label before scoring (class-forecast-quantile.R:146, class-forecast-nominal.R:145, class-forecast-ordinal.R:151). The multivariate sample method has no equivalent.
Possible fixes:
- Pair draws by
sample_idwithin each multivariate group, and error when asample_idis missing from some forecast units of the group. This also catches forecast units that have the same number of samples but differentsample_ids.assert_forecast()checks only the number, so row order currently pairs those draws without warning. - Or, at minimum, order predictions by
sample_idwithin each forecast unit before scoring, and document that every forecast unit in a group must have the same set ofsample_ids.
Reproduced with scoringutils 2.3.0. The pairing by row order is also in score.forecast_multivariate_sample() on main (779d7d6).
We came across this in hubEvals (hubverse-org/hubEvals), which passes hub model output to as_forecast_multivariate_sample() and will order rows by sample ID on its side in the meantime.
- Lenguaje dominante
- R
- Estrellas
- 68
- Forks
- 24
- Merge medio
- 1 h 24 min
- PR fusionados (30 d)
- 2
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de epiforecasts/scoringutils
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
epiforecasts/scoringutils#1264 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
epiforecasts/scoringutils#1265 ·
Los mantenedores suelen responder en 1 día
-
Non-randomised PIT for integer forecasts drops forecasts whose observation exceeds all samplesPosiblemente ocupada @chenyangsu la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
epiforecasts/scoringutils#1260 ·
Los mantenedores suelen responder en 1 día
-
Incorrect guidance in `NEWS.md` re `add_relative_skill()`?Posiblemente ocupada @nikosbosse la tomó hace 27 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
epiforecasts/scoringutils#1226 · 1 comentario · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
get_pit_histogram(): unsorted breaks produce negative densities; num_bins = 1 returns an empty tablePosiblemente ocupada @nikosbosse la tomó hace 27 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
epiforecasts/scoringutils#1219 ·
Los mantenedores suelen responder en 1 día
Todos los issues de epiforecasts/scoringutils
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
epiforecasts/cfrnow#70 · 1 comentario ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Cidree/duckspatial#202 ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
PRL-PRG/r-compile-server#70 · 1 comentario ·
-
dependencies docker enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
posit-dev/images-workbench#257 ·
Los mantenedores suelen responder en 1 día
-
dependencies docker enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
posit-dev/images-package-manager#188 ·
Los mantenedores suelen responder en 1 día