curso-r/treesnip

num_leaves vs tree_depth in lgbm

Athospd opened this issue · 2 comments

  • {parsnip} do not offer num_leaves as a hiperparameter. Only tree_depth
  • {lightgbm} demands num_leaves to be passed.
  • num_leaves do not have a default, but the doc shows suggestions. For a tree to be ruled only by tree_depth, num_leaves should be equal to 2^(tree_depth) - 1.
  • When tree_depth > 17, lightgbm throws the following error:
 Error in lgb.call("LGBM_DatasetCreateFromMat_R", ret = handle, private$raw_data,  : 
  [LightGBM] [Fatal] Check failed: (num_leaves) <= (131072)

I put a warning when tree_depth > 17, but I really don't know if it is needed nor it is in the right way.

I think that's totally fine. I don't think it's common to use tree_depth > 10.