Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# dials (development version)

* A bug was fixed where some space-filling designs did not respect the `original` argument (#409).

# dials 1.4.2

* `prop_terms()` is a new parameter object used for recipes that do supervised feature selection (#395).
Expand Down
2 changes: 1 addition & 1 deletion R/space_filling.R
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ make_sfd <- function(

if (has_premade_design) {
grid <- sfd::get_design(p, num_points = size, type = type)
vals <- purrr::map(params, \(.x) value_seq(.x, size))
vals <- purrr::map(params, \(.x) value_seq(.x, size, original = original))
vals <- purrr::map(vals, \(.x) base_recycle(.x, size))
grid <- sfd::update_values(grid, vals)
names(grid) <- names(params)
Expand Down
22 changes: 22 additions & 0 deletions tests/testthat/test-space_filling.R
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,25 @@ test_that("1-point grid", {
})
expect_equal(nrow(grid), 1L)
})

test_that("pre-made designs respect the 'original argument", {
# See issue #409

prms <- parameters(penalty(), mixture())
types <- c(
"audze_eglais",
"max_min_l1",
"max_min_l2",
"uniform",
"max_entropy",
"latin_hypercube"
)

for (i in types) {
grd_orig <- grid_space_filling(prms, type = i, original = TRUE)
grd_trans <- grid_space_filling(prms, type = i, original = FALSE)

expect_true(all(grd_orig$penalty > 0))
expect_true(all(grd_trans$penalty <= 0))
}
})