Skip to contents

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.

Usage

apply_metrics(forecast, metrics, ...)

Arguments

forecast

A forecast object (a validated data.table with predicted and observed values).

metrics

A named list of scoring functions. 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().

Value

A data table with the forecasts and the calculated metrics.