Skip to content

Rework add coverage()#390

Merged
nikosbosse merged 79 commits intorework-quantile-scoresfrom
rework-add_coverage()
Nov 16, 2023
Merged

Rework add coverage()#390
nikosbosse merged 79 commits intorework-quantile-scoresfrom
rework-add_coverage()

Conversation

@nikosbosse
Copy link
Copy Markdown
Collaborator

@nikosbosse nikosbosse commented Nov 4, 2023

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

  • adds a new function interval_coverage() to compute coverage alongside other metrics.

Making this work requires a function, run_safely(), which is introduced in #395

@nikosbosse nikosbosse mentioned this pull request Nov 4, 2023
@nikosbosse nikosbosse marked this pull request as draft November 7, 2023 14:47
@nikosbosse nikosbosse marked this pull request as ready for review November 9, 2023 10:50
@nikosbosse nikosbosse requested a review from seabbs November 9, 2023 14:51
Copy link
Copy Markdown
Contributor

@seabbs seabbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same liniting issues as #377 but otherwise looks all okay. I'd suggest making an issue for dealing with the lining issues as I assume they are widespread.

}


#' @title Interval Coverage (For Quantile-Based Forecasts)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space

# ==========================================================
n <- length(observed)
N <- length(predicted) / n
dt <- data.table(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(unless you are already importing all of data.table?

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)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repeated pattern. Do you even need this? If so it should be a function

nikosbosse and others added 12 commits November 15, 2023 15:36
First step towards reworking `score.scoringutils_quantile()` - adding coverage as a metric
Update `bias_quantile()` to work with vectors / matrices instead of data.table
Update functions to compute the absolute median
…uantile()2

Rework score.scoringutils quantile()2
Rework add coverage to work with raw forecasts
Add separate functions for wis components
@nikosbosse nikosbosse merged commit eb45cbb into rework-quantile-scores Nov 16, 2023
@nikosbosse nikosbosse deleted the rework-add_coverage() branch November 16, 2023 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants