保存lightgbm模型后,如何读取重要性
import lightgbm as lgb
import joblib
import matplotlib.pyplot as plt
def find_feature(path):
model = joblib.load(path)
# fig = plt.figure(figsize=(200, 200))
# ax = fig.subplots()
# print('导出决策树的pdf图像到本地')#这里需要安装graphviz应用程序和python安装包
# graph = lgb.create_tree_digraph(model, tree_index=0, name='Tree0')
# graph.render(view=True)
plt.figure(figsize=(12,6))
lgb.plot_importance(model, max_num_features=30)
plt.title("Featurertances")
plt.show()
find_feature(path)
image.png
本文标题:保存lightgbm模型后,如何读取重要性
本文链接:https://www.haomeiwen.com/subject/ldavldtx.html
网友评论