美文网首页
保存lightgbm模型后,如何读取重要性

保存lightgbm模型后,如何读取重要性

作者: Colleen_oh | 来源:发表于2023-03-07 11:00 被阅读0次
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