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('導(dǎo)出決策樹(shù)的pdf圖像到本地')#這里需要安裝graphviz應(yīng)用程序和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