epiforecasts / scoringutils

Utilities for Scoring and Assessing Predictions
https://epiforecasts.io/scoringutils/
Other
48 stars 20 forks source link

Fix `quantile_score()` #878

Closed nikosbosse closed 1 month ago

nikosbosse commented 1 month ago

The current quantile_score() doesn't work with a single vector as an input. The following line

tau_diff <- sweep(obs_smaller_pred, 2, quantile_level)

needs to be changed to

if (is.atomic(observed)) {
    tau_diff <- ifelse(obs_smaller_pred, 1 - quantile_level, quantile_level)
  } else {
    tau_diff <- sweep(obs_smaller_pred, 2, quantile_level)
  }

--> double check whether that's actually true, i.e. whether we need the ifelse here. Also should there be an absolute value somewhere?

nikosbosse commented 1 month ago

Also this can be deleted

################################################################################
# Metrics with a one-to-one relationship between input and score
################################################################################

as well as the wis_one_to_one function I think...