从Python中的H2OXGBoostEstimator模型中提取原生xgboost模型

2024-10-01 22:26:38 发布

您现在位置:Python中文网/ 问答频道 /正文

是否可以从Python中的h2oxgboosttestimator模型中提取本机xgboost模型pickle文件并由原始的xgboost Python API读入?谢谢!在


Tags: 文件模型apipicklexgboosth2oxgboosttestimator
1条回答
网友
1楼 · 发布于 2024-10-01 22:26:38

您可以使用以下方法:

import matplotlib.pyplot as plt
from xgboost import plot_tree

# model is your xgboost model, choose which tree in num_trees and layout direction default if top to bottom, LR is left to right
plot_tree(model, num_trees=0, rankdir='LR') 
plt.show()

这里是一个完全可复制的示例,但请注意它使用的是xgboost repo中的dataset,并使用这个example来创建模型

^{pr2}$

相关问题 更多 >

    热门问题