Skip to contents

For nominal forecasts, the default scoring rule is:

Usage

# S3 method for class 'forecast_nominal'
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 is NULL (the default), all possible scoring rules are returned.

exclude

A character vector of scoring rules to exclude from the list. If select is not NULL, this argument is ignored.

...

unused

Examples

get_metrics(example_nominal)
#> $log_score
#> function (observed, predicted, predicted_label) 
#> {
#>     assert_input_categorical(observed, predicted, predicted_label)
#>     n <- length(observed)
#>     if (n == 1) {
#>         predicted <- matrix(predicted, nrow = 1)
#>     }
#>     observed_indices <- as.numeric(observed)
#>     pred_for_observed <- predicted[cbind(1:n, observed_indices)]
#>     logs <- -log(pred_for_observed)
#>     return(logs)
#> }
#> <bytecode: 0x55993578b3f8>
#> <environment: namespace:scoringutils>
#>