Skip to content

Commit

Permalink
clean up tests, typos
Browse files Browse the repository at this point in the history
  • Loading branch information
sumny committed Aug 19, 2024
1 parent 53473c4 commit cef90bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion R/SurrogateLearnerCollection.R
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ SurrogateLearnerCollection = R6Class("SurrogateLearnerCollection",

# Train learner with new data.
# Also calculates the insample performance based on the `perf_measures` hyperparameter if `assert_insample_perf = TRUE`.
# If
.update = function() {
assert_true((length(self$cols_y) == length(self$learner)) || length(self$cols_y) == 1L) # either as many cols_y as learner or only one
one_to_multiple = length(self$cols_y) == 1L
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_AcqOptimizer.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ test_that("AcqOptimizer API works", {
acqopt$param_set$values$warmstart = TRUE
xdt = acqopt$optimize()
expect_true(xdt[["x"]] == 0)
expect_true(xdt[[".already_evaluated"]] == FALSE)
expect_false(xdt[[".already_evaluated"]])

acqopt$param_set$values$warmstart_size = 1L
xdt = acqopt$optimize()
expect_true(xdt[["x"]] == 0)
expect_true(xdt[[".already_evaluated"]] == FALSE)
expect_false(xdt[[".already_evaluated"]])

acqopt = AcqOptimizer$new(opt("grid_search", resolution = 4L, batch_size = 1L), trm("evals", n_evals = 8L), acq_function = acqfun)
acqopt$param_set$values$warmstart = TRUE
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test_sugar.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
test_that("SurrogateLearner sugar", {
surrogate = srlrn(REGR_FEATURELESS, catch_errors = FALSE)
expect_r6(surrogate, classes = "SurrogateLearner")
expect_equal(surrogate$param_set$values$catch_errors, FALSE)
expect_false(surrogate$param_set$values$catch_errors)
})

test_that("SurrogateLearnerCollection sugar", {
surrogate = srlrn(list(REGR_FEATURELESS, REGR_FEATURELESS$clone(deep = TRUE)), catch_errors = FALSE)
expect_r6(surrogate, classes = "SurrogateLearnerCollection")
expect_equal(surrogate$param_set$values$catch_errors, FALSE)
expect_false(surrogate$param_set$values$catch_errors)
})

test_that("AcqFunction sugar", {
Expand All @@ -19,7 +19,7 @@ test_that("AcqFunction sugar", {
test_that("AcqOptimizer sugar", {
acqoptimizer = acqo(opt("random_search"), trm("evals"), catch_errors = FALSE)
expect_r6(acqoptimizer, "AcqOptimizer")
expect_equal(acqoptimizer$param_set$values$catch_errors, FALSE)
expect_false(acqoptimizer$param_set$values$catch_errors)
})

test_that("ResultAssigner sugar", {
Expand Down

0 comments on commit cef90bd

Please sign in to comment.