Skip to content
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

make lightgbm's num_leaves engine arg tunable #838

Merged
merged 1 commit into from Nov 3, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion DESCRIPTION
Expand Up @@ -41,7 +41,7 @@ Imports:
Suggests:
C50,
covr,
dials (>= 0.1.0),
dials (>= 1.0.0.9001),
earth,
ggrepel,
keras,
Expand Down Expand Up @@ -76,3 +76,5 @@ LazyData: true
Roxygen: list(markdown = TRUE)
Config/testthat/edition: 3
RoxygenNote: 7.2.1.9000
Remotes:
tidymodels/dials#256
3 changes: 3 additions & 0 deletions NEWS.md
Expand Up @@ -2,6 +2,9 @@

* The matrix interface for fitting `fit_xy()` now works for the `"censored regression"` mode (#829).

* The `num_leaves` argument of `boost_tree()`s `lightgbm` engine (via the bonsai package) is now tunable.


# parsnip 1.0.2

* A bagged neural network model was added (`bag_mlp()`). Engine implementations will live in the baguette package.
Expand Down
14 changes: 14 additions & 0 deletions R/tunable.R
Expand Up @@ -94,6 +94,19 @@ xgboost_engine_args <-
component_id = "engine"
)

lightgbm_engine_args <-
tibble::tibble(
name = c(
"num_leaves"
),
call_info = list(
list(pkg = "dials", fun = "num_leaves")
),
source = "model_spec",
component = "boost_tree",
component_id = "engine"
)

ranger_engine_args <-
tibble::tibble(
name = c(
Expand Down Expand Up @@ -244,6 +257,7 @@ tunable_boost_tree <- function(x, ...) {
res$call_info[res$name == "sample_size"] <-
list(list(pkg = "dials", fun = "sample_prop"))
} else if (x$engine == "lightgbm") {
res <- add_engine_parameters(res, lightgbm_engine_args)
res$call_info[res$name == "sample_size"] <-
list(list(pkg = "dials", fun = "sample_prop"))
}
Expand Down