保存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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容