assert_forecast.forecast_binary <- function(
forecast, forecast_type = NULL, verbose = TRUE, ...
) {
forecast <- assert_forecast_generic(forecast, verbose)
assert_forecast_type(forecast, actual = "binary", desired = forecast_type)
columns_correct <- test_columns_not_present(
forecast, c("sample_id", "quantile_level")
)
if (!columns_correct) {
#nolint start: keyword_quote_linter
cli_abort(
c(
"!" = "Checking `forecast`: Input looks like a binary forecast, but an
additional column called `sample_id` or `quantile` was found.",
"i" = "Please remove the column."
)
)
}
input_check <- check_input_binary(forecast$observed, forecast$predicted)
if (!isTRUE(input_check)) {
cli_abort(
c(
"!" = "Checking `forecast`: Input looks like a binary forecast, but
found the following issue: {input_check}"
)
)
#nolint end
}
return(invisible(NULL))
}
I'm leaning towards doing all input checks on the lower level functions (i.e. when you actually call the score), but we should probably do it the same everywhere.
We have input checks on multiple levels. Here are the assert statements that make sure a forecast is of a specific type.
Some of these functions just check the minimum requirements, e.g.
Others also test the input columns:
I'm leaning towards doing all input checks on the lower level functions (i.e. when you actually call the score), but we should probably do it the same everywhere.