
Get default metrics for sample-based forecasts
Source:R/class-forecast-multivariate-sample.R
get_metrics.forecast_sample_multivariate.Rd
For sample-based multivariate forecasts, the default scoring rules are:
"energy_score" =
energy_score_multivariate()
Usage
# S3 method for class 'forecast_sample_multivariate'
get_metrics(x, select = NULL, exclude = NULL, ...)
Arguments
- x
A forecast object (a validated data.table with predicted and observed values, see
as_forecast_binary()
).- select
A character vector of scoring rules to select from the list. If
select
isNULL
(the default), all possible scoring rules are returned.- exclude
A character vector of scoring rules to exclude from the list. If
select
is notNULL
, this argument is ignored.- ...
unused
See also
Other get_metrics functions:
get_metrics()
,
get_metrics.forecast_binary()
,
get_metrics.forecast_nominal()
,
get_metrics.forecast_ordinal()
,
get_metrics.forecast_point()
,
get_metrics.forecast_quantile()
,
get_metrics.forecast_sample()
,
get_metrics.scores()
Examples
example <- as_forecast_multivariate_sample(
example_sample_continuous, joint_across = c("location", "location_name")
)
#> ℹ Some rows containing NA values may be removed. This is fine if not
#> unexpected.
get_metrics(example)
#> $energy_score
#> function (observed, predicted, mv_group_id, w = NULL)
#> {
#> assert_input_multivariate_sample(observed, predicted, mv_group_id)
#> unique_groups <- unique(mv_group_id)
#> energy_score <- vapply(unique_groups, function(group) {
#> idx <- which(mv_group_id == group)
#> es_sample(y = observed[idx], dat = predicted[idx, , drop = FALSE],
#> w = w)
#> }, numeric(1))
#> names(energy_score) <- unique_groups
#> return(energy_score)
#> }
#> <bytecode: 0x55c1892c8e78>
#> <environment: namespace:scoringutils>
#>