Skip to contents

For binary forecasts, the default scoring rules are:

Usage

# S3 method for class 'forecast_binary'
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

Value

A list of scoring functions.

Input format

Examples

get_metrics(example_binary)
#> $brier_score
#> function (observed, predicted) 
#> {
#>     assert_input_binary(observed, predicted)
#>     observed <- as.numeric(observed) - 1
#>     brierscore <- (observed - predicted)^2
#>     return(brierscore)
#> }
#> <bytecode: 0x56416acdd598>
#> <environment: namespace:scoringutils>
#> 
#> $log_score
#> function (observed, predicted) 
#> {
#>     assert_input_binary(observed, predicted)
#>     observed <- as.numeric(observed) - 1
#>     logs <- -log(1 - abs(observed - predicted))
#>     return(logs)
#> }
#> <bytecode: 0x56416ace0590>
#> <environment: namespace:scoringutils>
#> 
get_metrics(example_binary, select = "brier_score")
#> $brier_score
#> function (observed, predicted) 
#> {
#>     assert_input_binary(observed, predicted)
#>     observed <- as.numeric(observed) - 1
#>     brierscore <- (observed - predicted)^2
#>     return(brierscore)
#> }
#> <bytecode: 0x56416acdd598>
#> <environment: namespace:scoringutils>
#> 
get_metrics(example_binary, exclude = "log_score")
#> $brier_score
#> function (observed, predicted) 
#> {
#>     assert_input_binary(observed, predicted)
#>     observed <- as.numeric(observed) - 1
#>     brierscore <- (observed - predicted)^2
#>     return(brierscore)
#> }
#> <bytecode: 0x56416acdd598>
#> <environment: namespace:scoringutils>
#>