epiforecasts / scoringutils

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

Issue #310 - Improve imputation of median in `bias_quantile()` #786

Closed nikosbosse closed 4 months ago

nikosbosse commented 4 months ago

Description

This PR closes #310.

As suggested by @sbfnk in #310, this PR improves the way we impute the median in bias_quantile() when it's missing. Previously, we took a simple mean of the two innermost quantiles. Now, we do a linear interpolation between the two, handling cases in which the two innermost quantiles are not symmetric around the median.

This PR

I think I did everything correctly. But also this is a late night PR, so I'd appreciate an extra pair of eyes on the interpolation logic.

Checklist

nikosbosse commented 4 months ago

Latest update:

### Function changes
- `bias_quantile()` changed the way it handles forecasts where the median is missing: The median is now imputed by linear interpolation between the innermost quantiles. Previously, we imputed the median by simply taking the mean of the innermost quantiles.