Get default metrics for nominal forecasts
Source:R/class-forecast-nominal.R
get_metrics.forecast_nominal.Rd
For nominal forecasts, the default scoring rule is:
"log_score" =
logs_categorical()
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
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_ordinal()
,
get_metrics.forecast_point()
,
get_metrics.forecast_quantile()
,
get_metrics.forecast_sample()
,
get_metrics.scores()
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>
#>