In this code:
|
n <- length(observed) |
|
N <- length(predicted) / n |
we convert from a sample format to a quantile format so that we can use the data.frame
sample_to_quantile. It would be better if we instead had a helper function to do this.
Reproduced here:
assert_input_sample(observed, predicted)
assert_number(range)
necessary_quantiles <- c((100 - range) / 2, 100 - (100 - range) / 2) / 100
# this could be its own function, sample_to_quantile.numeric
# ==========================================================
n <- length(observed)
N <- length(predicted) / n
dt <- data.table(
observed = rep(observed, each = N),
predicted = as.vector(t(predicted))
)
quantile_dt <- sample_to_quantile(dt, necessary_quantiles)
In this code:
scoringutils/R/metrics-sample.R
Lines 305 to 306 in e43e008
sample_to_quantile. It would be better if we instead had a helper function to do this.Reproduced here: