This helper function applies scoring rules (stored as a list of
functions) to a data table of forecasts. apply_metrics is used within
score() to apply all scoring rules to the data.
Scoring rules are wrapped in run_safely() to catch errors and to make
sure that only arguments are passed to the scoring rule that are actually
accepted by it. A warning is issued if any column names in the input
data match names in the metrics list, as these will be overwritten.
apply_metrics(forecast, metrics, ...)A data table with the forecasts and the calculated metrics.
A forecast object (a validated data.table with predicted and observed values).
A named list of scoring functions. Each element should be a
function reference, not a function call. For example, use
list("crps" = crps_sample) rather than list("crps" = crps_sample()).
Names will be used as column names in the output. See get_metrics() for
more information on the default metrics used. See the Customising metrics
section below for information on how to pass custom arguments to scoring
functions.
Additional arguments to be passed to the scoring rules. Note that
this is currently not used, as all calls to apply_scores currently
avoid passing arguments via ... and instead expect that the metrics
directly be modified using purrr::partial().