bonsai 0.2.1
- The most recent dials and parsnip releases introduced tuning integration for the lightgbm
num_leaves
engine argument! Thenum_leaves
parameter sets the maximum number of nodes per tree, and is an important tuning parameter for lightgbm (tidymodels/dials#256, tidymodels/parsnip#838). With the newest version of each of dials, parsnip, and bonsai installed, tune this argument by marking thenum_leaves
engine argument for tuning when defining your model specification:
boost_tree() %>% set_engine("lightgbm", num_leaves = tune())
- Fixed a bug where lightgbm's parallelism argument
num_threads
was overridden when passed viaparam
rather than as a main argument. By default, then, lightgbm will fit sequentially rather than withnum_threads = foreach::getDoParWorkers()
. The user can still setnum_threads
via engine arguments withengine = "lightgbm"
:
boost_tree() %>% set_engine("lightgbm", num_threads = x)
Note that, when tuning hyperparameters with the tune package, detection of parallel backend will still work as usual.
-
The
boost_tree
argumentstop_iter
now maps to thelightgbm:::lgb.train()
argumentearly_stopping_round
rather than its aliasearly_stopping_rounds
. This does not affect parsnip's interface to lightgbm (i.e. viaboost_tree() %>% set_engine("lightgbm")
), though will introduce errors for code that uses thetrain_lightgbm()
wrapper directly and sets thelightgbm::lgb.train()
argumentearly_stopping_round
by its aliasearly_stopping_rounds
viatrain_lightgbm()
's...
. -
Disallowed passing main model arguments as engine arguments to
set_engine("lightgbm", ...)
via aliases. That is, if a main argument is marked for tuning and a lightgbm alias is supplied as an engine argument, bonsai will now error, rather than supplying both to lightgbm and allowing the package to handle aliases. Users can still interface with non-mainboost_tree()
arguments via their lightgbm aliases (#53).