Plot a Single XGBoost Decision Tree

前端 未结 4 1970
慢半拍i
慢半拍i 2021-01-05 04:13

I am using method on https://machinelearningmastery.com/visualize-gradient-boosting-decision-trees-xgboost-python/ to plot a XGBoost Decision Tree

from numpy         


        
4条回答
  •  北荒
    北荒 (楼主)
    2021-01-05 04:45

    I found this workaround on github, which also gives better images with the drawback that you have to open the .png file after.

    xgb.plot_tree(bst, num_trees=2)
    fig = matplotlib.pyplot.gcf()
    fig.set_size_inches(150, 100)
    fig.savefig('tree.png')
    

提交回复
热议问题