apply_metrics: Apply a list of functions to a data table of forecasts

apply_metricsR Documentation

Apply a list of functions to a data table of forecasts

Description

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, see as_forecast())

metrics

A named list of scoring functions. Names will be used as column names in the output. See metrics_point(), metrics_binary(), metrics_quantile(), and metrics_sample() for more information on the default metrics used. Note that if you want to pass arguments to any given metric, you should do that through the function customise_metric() and pass an updated list of functions with your custom metric to the metrics argument in score().

...

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 customise_metric().

Value

A data table with the forecasts and the calculated metrics.


epiforecasts/scoringutils documentation built on April 23, 2024, 4:56 p.m.