diff --git a/R/forecast.R b/R/forecast.R index 94f5d5602..9472976ff 100644 --- a/R/forecast.R +++ b/R/forecast.R @@ -480,7 +480,7 @@ assert_forecast.forecast_nominal <- function( # forecasts need to be complete forecast_unit <- get_forecast_unit(forecast) - complete <- forecast[, .( + complete <- as.data.table(forecast)[, .( correct = test_set_equal(as.character(predicted_label), outcomes) ), by = forecast_unit] diff --git a/R/score.R b/R/score.R index 1674796da..b7e0c7d3f 100644 --- a/R/score.R +++ b/R/score.R @@ -133,6 +133,7 @@ score.forecast_nominal <- function(forecast, metrics = metrics_nominal(), ...) { forecast <- clean_forecast(forecast, copy = TRUE, na.omit = TRUE) forecast_unit <- get_forecast_unit(forecast) metrics <- validate_metrics(metrics) + forecast <- as.data.table(forecast) # transpose the forecasts that belong to the same forecast unit # make sure the labels and predictions are ordered in the same way