Rework add coverage()#390
Merged
nikosbosse merged 79 commits intorework-quantile-scoresfrom Nov 16, 2023
Merged
Conversation
Closed
…e-based forecasts
Update branch to include coverage functions
…t deals with the wis components
…he name is terrible
…intervals from quantiles
… and other functions with the same arguments
… other data documentation (seems it was ignored anyway)
…ame of the coverage columns
…eviously failing due to `add_coverage()`
…cause we can't pass the `forecast_unit` arg to apply_metrics
…wasn't working and everything else feels more complicated.
seabbs
approved these changes
Nov 15, 2023
| } | ||
|
|
||
|
|
||
| #' @title Interval Coverage (For Quantile-Based Forecasts) |
| # ========================================================== | ||
| n <- length(observed) | ||
| N <- length(predicted) / n | ||
| dt <- data.table( |
Contributor
There was a problem hiding this comment.
(unless you are already importing all of data.table?
R/utils_data_handling.R
Outdated
| quantiles = c(0.05, 0.25, 0.5, 0.75, 0.95), | ||
| type = 7) { | ||
| data <- data.table::as.data.table(data) | ||
| if (!is.data.table(data)) { |
Contributor
There was a problem hiding this comment.
repeated pattern. Do you even need this? If so it should be a function
First step towards reworking `score.scoringutils_quantile()` - adding coverage as a metric
Update `bias_quantile()` to work with vectors / matrices instead of data.table
…, `underprediction()` and `dispersion()`
Update functions to compute the absolute median
…uantile()2 Rework score.scoringutils quantile()2
Move tests around
Expand tests2
Rework add coverage to work with raw forecasts
Simplify `score()`
Add separate functions for wis components
Fix set forecast unit
Add coverage deviation as a metric
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR started out adding a new function
add_coverage_raw_data()that computed coverage based on the raw data, rather than the scores (see #389).After discussion with @seabbs I deleted all of that and now this PR
interval_coverage()to compute coverage alongside other metrics.Making this work requires a function,
run_safely(), which is introduced in #395