From e62c2f7e842ee698a8f3dd1904c76384573afa8f Mon Sep 17 00:00:00 2001 From: topepo Date: Sun, 16 Nov 2025 12:25:59 -0500 Subject: [PATCH 1/2] updated tunables for boosting --- NEWS.md | 5 +++++ R/tunable.R | 29 ++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 7977fc733..e38bbf6b3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # parsnip (development version) +* Updates to some boosting tuning parameter information: + - lightgbm and catboost have smaller default ranges for the learning rate: -3 to -1 / 2 in log10 units. + - lightgbm, xgboost, catboost, and C5.0 have smaller default ranges for the sampling proportion: 0.5 to 1.0. + - catboost engine arguments were added for `max_leaves` and `l2_leaf_reg`. + * Enable generalized random forest (`grf`) models for classification, regression, and quantile regression modes. (#1288) * `surv_reg()` is now defunct and will error if called. Please use `survival_reg()` instead (#1206). diff --git a/R/tunable.R b/R/tunable.R index 8d2e86f8b..077121558 100644 --- a/R/tunable.R +++ b/R/tunable.R @@ -124,6 +124,21 @@ lightgbm_engine_args <- component_id = "engine" ) +catboost_engine_args <- + tibble::tibble( + name = c( + "max_leaves", + "l2_leaf_reg" + ), + call_info = list( + list(pkg = "dials", fun = "num_leaves"), + list(pkg = "dials", fun = "penalty", range = c(-4, 1)) + ), + source = "model_spec", + component = "boost_tree", + component_id = "engine" + ) + ranger_engine_args <- tibble::tibble( name = c( @@ -345,7 +360,7 @@ tunable.boost_tree <- function(x, ...) { if (x$engine == "xgboost") { res <- add_engine_parameters(res, xgboost_engine_args) res$call_info[res$name == "sample_size"] <- - list(list(pkg = "dials", fun = "sample_prop")) + list(list(pkg = "dials", fun = "sample_prop", range = c(0.5, 1.0))) res$call_info[res$name == "learn_rate"] <- list(list(pkg = "dials", fun = "learn_rate", range = c(-3, -1 / 2))) } else if (x$engine == "C5.0") { @@ -353,11 +368,19 @@ tunable.boost_tree <- function(x, ...) { res$call_info[res$name == "trees"] <- list(list(pkg = "dials", fun = "trees", range = c(1, 100))) res$call_info[res$name == "sample_size"] <- - list(list(pkg = "dials", fun = "sample_prop")) + list(list(pkg = "dials", fun = "sample_prop", range = c(0.5, 1.0))) } 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")) + list(list(pkg = "dials", fun = "sample_prop", range = c(0.5, 1.0))) + res$call_info[res$name == "learn_rate"] <- + list(list(pkg = "dials", fun = "learn_rate", range = c(-3, -1 / 2))) + } else if (x$engine == "catboost") { + res <- add_engine_parameters(res, catboost_engine_args) + res$call_info[res$name == "learn_rate"] <- + list(list(pkg = "dials", fun = "learn_rate", range = c(-3, -1 / 2))) + res$call_info[res$name == "sample_size"] <- + list(list(pkg = "dials", fun = "sample_prop", range = c(0.5, 1.0))) } res } From 8d9a8e7deeba491931fd9302c934e856672c5ed3 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Wed, 19 Nov 2025 08:00:28 -0800 Subject: [PATCH 2/2] Update NEWS.md --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index e38bbf6b3..234821fc7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # parsnip (development version) -* Updates to some boosting tuning parameter information: +* Updates to some boosting tuning parameter information: (#1306) - lightgbm and catboost have smaller default ranges for the learning rate: -3 to -1 / 2 in log10 units. - lightgbm, xgboost, catboost, and C5.0 have smaller default ranges for the sampling proportion: 0.5 to 1.0. - catboost engine arguments were added for `max_leaves` and `l2_leaf_reg`.