Skip to contents

Setup hyperparameters for LightRF training.

Usage

setup_LightRF(
  nrounds = 500L,
  num_leaves = 4096L,
  max_depth = -1L,
  feature_fraction = NULL,
  subsample = 0.623,
  lambda_l1 = 0,
  lambda_l2 = 0,
  max_cat_threshold = 32L,
  min_data_per_group = 32L,
  linear_tree = FALSE,
  ifw = FALSE,
  objective = NULL,
  device_type = "cpu",
  tree_learner = "serial",
  force_col_wise = TRUE
)

Arguments

nrounds

(Tunable) Integer [1, Inf): Number of boosting rounds.

num_leaves

(Tunable) Integer [1, Inf): Maximum number of leaves in one tree.

max_depth

(Tunable) Integer: Maximum depth of trees. -1 = no limit.

feature_fraction

(Tunable) Optional Numeric (0, 1]: Fraction of features to use. NULL derives it from the data: sqrt(n_features)/n_features for classification, 0.33 for regression.

subsample

(Tunable) Numeric (0, 1]: Fraction of data to use.

lambda_l1

(Tunable) Numeric [0, Inf): L1 regularization.

lambda_l2

(Tunable) Numeric [0, Inf): L2 regularization.

max_cat_threshold

(Tunable) Integer [1, Inf): Maximum number of categories for categorical features.

min_data_per_group

(Tunable) Integer [1, Inf): Minimum number of observations per categorical group.

linear_tree

(Tunable) Logical: If TRUE, use linear trees.

ifw

(Tunable) Logical: If TRUE, use Inverse Frequency Weighting in classification.

objective

Optional Character: Objective function. NULL = set from outcome type.

device_type

Character {"cpu", "gpu", "cuda"}: Compute device.

tree_learner

Character {"serial", "feature", "data", "voting"}: Tree learner type.

force_col_wise

Logical: Use only with CPU - If TRUE, force col-wise histogram building.

Value

LightRFHyperparameters object.

Details

Get more information from lightgbm::lgb.train. Note that boosting_type, learning_rate, subsample_freq and early_stopping_rounds are constants here: they cannot be set, because they are what makes lightgbm train a random forest. All of them are settable when training gradient boosting with LightGBM.

Author

EDG

Examples

lightrf_hyperparams <- setup_LightRF(nrounds = 1000L, ifw = FALSE)
lightrf_hyperparams
#> <LightRFHyperparameters>
#>         hyperparameters: 
#>                                  boosting_type: <chr> rf
#>                                  learning_rate: <nmr> 1.00
#>                                 subsample_freq: <int> 1
#>                          early_stopping_rounds: <int> -1
#>                                        nrounds: <int> 1000
#>                                     num_leaves: <int> 4096
#>                                      max_depth: <int> -1
#>                               feature_fraction: <NUL> NULL
#>                                      subsample: <nmr> 0.62
#>                                      lambda_l1: <nmr> 0.00
#>                                      lambda_l2: <nmr> 0.00
#>                              max_cat_threshold: <int> 32
#>                             min_data_per_group: <int> 32
#>                                    linear_tree: <lgc> FALSE
#>                                            ifw: <lgc> FALSE
#>                                      objective: <NUL> NULL
#>                                    device_type: <chr> cpu
#>                                   tree_learner: <chr> serial
#>                                 force_col_wise: <lgc> TRUE
#> tunable_hyperparameters: <chr> nrounds, num_leaves, max_depth, feature_fraction, subsample, lambda_l1, lambda_l2, max_cat_threshold, min_data_per_group, linear_tree, ifw
#>   fixed_hyperparameters: <chr> objective, device_type, tree_learner, force_col_wise
#>                   tuned: <int> -1
#>               resampled: <int> 0
#>               n_workers: <int> 1
#> 
#>   No search values defined for tunable hyperparameters.