library(magrittr) # pipe operator
# \dontshow{
  data.table::setDTthreads(2) # restricts number of cores used on CRAN
# }
check_forecasts(example_quantile)
score(example_quantile) %>%
  add_coverage(by = c("model", "target_type")) %>%
  summarise_scores(by = c("model", "target_type"))
# set forecast unit manually (to avoid issues with scoringutils trying to
# determine the forecast unit automatically), check forecasts before scoring
example_quantile %>%
  set_forecast_unit(
    c("location", "target_end_date", "target_type", "horizon", "model")
  ) %>%
  check_forecasts() %>%
  score()
# forecast formats with different metrics
if (FALSE) {
score(example_binary)
score(example_quantile)
score(example_integer)
score(example_continuous)
}
# score point forecasts (marked by 'NA' in the quantile column)
score(example_point) %>%
  summarise_scores(by = "model", na.rm = TRUE)
Run the code above in your browser using DataLab