Skip to content

Commit 624dabc

Browse files
authored
make lightgbm's num_leaves engine arg tunable (#838)
1 parent 073b856 commit 624dabc

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

DESCRIPTION

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Imports:
4141
Suggests:
4242
C50,
4343
covr,
44-
dials (>= 0.1.0),
44+
dials (>= 1.0.0.9001),
4545
earth,
4646
ggrepel,
4747
keras,
@@ -76,3 +76,5 @@ LazyData: true
7676
Roxygen: list(markdown = TRUE)
7777
Config/testthat/edition: 3
7878
RoxygenNote: 7.2.1.9000
79+
Remotes:
80+
tidymodels/dials#256

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

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

5+
* The `num_leaves` argument of `boost_tree()`s `lightgbm` engine (via the bonsai package) is now tunable.
6+
7+
58
# parsnip 1.0.2
69

710
* A bagged neural network model was added (`bag_mlp()`). Engine implementations will live in the baguette package.

R/tunable.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ xgboost_engine_args <-
9494
component_id = "engine"
9595
)
9696

97+
lightgbm_engine_args <-
98+
tibble::tibble(
99+
name = c(
100+
"num_leaves"
101+
),
102+
call_info = list(
103+
list(pkg = "dials", fun = "num_leaves")
104+
),
105+
source = "model_spec",
106+
component = "boost_tree",
107+
component_id = "engine"
108+
)
109+
97110
ranger_engine_args <-
98111
tibble::tibble(
99112
name = c(
@@ -244,6 +257,7 @@ tunable_boost_tree <- function(x, ...) {
244257
res$call_info[res$name == "sample_size"] <-
245258
list(list(pkg = "dials", fun = "sample_prop"))
246259
} else if (x$engine == "lightgbm") {
260+
res <- add_engine_parameters(res, lightgbm_engine_args)
247261
res$call_info[res$name == "sample_size"] <-
248262
list(list(pkg = "dials", fun = "sample_prop"))
249263
}

0 commit comments

Comments
 (0)