Skip to content

Commit

Permalink
tests: check if predictions retrieved with as.data.table and predicti…
Browse files Browse the repository at this point in the history
…ons method are equal (#1130)
  • Loading branch information
be-marc authored Aug 29, 2024
1 parent 05f1103 commit 482f53a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/testthat/test_benchmark.R
Original file line number Diff line number Diff line change
Expand Up @@ -557,3 +557,13 @@ test_that("obs_loss", {
expect_true(all(is.na(tbl$classif.auc)))
expect_integer(tbl$classif.acc)
})

test_that("predictions retrieved with as.data.table and predictions method are equal", {
tab = as.data.table(bmr)
predictions = unlist(map(bmr$resample_results$resample_result, function(rr) rr$predictions()), recursive = FALSE)
expect_equal(tab$prediction, predictions)

tab = as.data.table(bmr, predict_sets = "train")
predictions = unlist(map(bmr$resample_results$resample_result, function(rr) rr$predictions(predict_sets = "train")), recursive = FALSE)
expect_equal(tab$prediction, predictions)
})

0 comments on commit 482f53a

Please sign in to comment.