Skip to content

Add mixture to brulee's tunable #1237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2025
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
Expand Up @@ -33,6 +33,8 @@

* Fixed bug where some models fit using `fit_xy()` couldn't predict (#1166).

* `tunable()` now references a dials object for the `mixture` parameter (#1236)

## Breaking Change

* For quantile prediction, the `quantile` argument to `predict()` has been deprecate in facor of `quantile_levels`. This does not affect models with mode `"quantile regression"`.
Expand Down
5 changes: 2 additions & 3 deletions R/tunable.R
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,9 @@ brulee_mlp_engine_args <-
"largest", list(pkg = "dials", fun = "rate_largest"),
"rate_schedule", list(pkg = "dials", fun = "rate_schedule"),
"step_size", list(pkg = "dials", fun = "rate_step_size"),
"steps", list(pkg = "dials", fun = "rate_steps")
"mixture", list(pkg = "dials", fun = "mixture")
) %>%
dplyr::mutate(,
source = "model_spec",
dplyr::mutate(source = "model_spec",
component = "mlp",
component_id = "engine"
)
Expand Down
1 change: 1 addition & 0 deletions parsnip.Rproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Version: 1.0
ProjectId: 7f6c9ff5-6b9a-4235-8666-12db5ef65d49

RestoreWorkspace: No
SaveWorkspace: No
Expand Down
22 changes: 22 additions & 0 deletions tests/testthat/test-tunable.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
test_that('brulee has mixture object', {
# for issue 1236
mlp_spec <-
mlp(
hidden_units = tune(),
activation = tune(),
penalty = tune(),
learn_rate = tune(),
epoch = 2000
) %>%
set_mode("regression") %>%
set_engine("brulee",
stop_iter = tune(),
mixture = tune(),
rate_schedule = tune())

brulee_res <- tunable(mlp_spec)

expect_true(
length(brulee_res$call_info[brulee_res$name == "mixture"]) > 0
)
})
Loading