dmlc / xgboost

Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow
https://xgboost.readthedocs.io/en/stable/
Apache License 2.0
26.11k stars 8.7k forks source link

How can I plot_tree with gain&cover? #7719

Open riaris opened 2 years ago

riaris commented 2 years ago

hello, Ex.me when I use plot_tree I can get the graph ,tree with node, leaf and the splitting condition. however, when I use get_dump(dump_format = 'text', with_stats = True), I can get the nodes' cover&gain, After I check the source, I see dump_format='dot', with_stats = False, but, even when I change with_stats = True, Nothing change, it still have not gain&cover in the return string.

divir94 commented 4 months ago

This will be helpful to add. It seems like if the format is "dot", then the stats are ignored.

print("cover" in bst.get_dump(dump_format="text", with_stats=True)[0])  # True
print("cover" in bst.get_dump(dump_format="dot", with_stats=True)[0])  # False