From ce7a0f2aa31c193284154ec2b2d22be5a7a096fa Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Sat, 10 Aug 2024 14:08:31 +0200 Subject: [PATCH 1/2] convert to data.table before subsetting --- R/forecast.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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] From e13d2772fcf24def9ebf4be170f9207d94c66204 Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Sat, 10 Aug 2024 14:14:26 +0200 Subject: [PATCH 2/2] fix issue --- R/score.R | 1 + 1 file changed, 1 insertion(+) 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