0

In random forest type models, there is usually an attribute like "estimators" which returns all the tree split as a list of lists. I can't seem find something similar with lightgbm. The closest I can come is lgb.plot_tree which gives a nice visualization of a single tree. But I would like to use the data shown in the visualization in variables.

How can I get at this data?

Bigga
  • 538
  • 6
  • 16

1 Answers1

1

There's not something exactly the same in LightGBM. But you could use the dump_model or trees_to_dataframe methods of the booster_ attribute of the scikit-learn estimator, i.e.

clf = lgb.LGBMClassifier().fit(X, y)
clf.booster_.dump_model()
clf.booster_.trees_to_dataframe()
josemz
  • 1,283
  • 7
  • 15