# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
import os

import lightgbm as lgb

import matplotlib.pyplot as plt


# -



# +
DATA = '../data/run5'

for fold_no in [1]:    
    model_file = os.path.join(DATA, f"fold{fold_no}_model.txt")
    model = lgb.Booster(model_file=model_file)
    
    for importance_type in ['gain', 'split']:
        f, ax = plt.subplots(figsize=[7, 10])        
        lgb.plot_importance(model, max_num_features=50, ax=ax, importance_type=importance_type)
        plt.title("Light GBM Feature Importance")

        out_file = os.path.join(DATA, f"fold{fold_no}_importance_{importance_type}.png")
        plt.savefig(out_file)

# -





StarcoderdataJupyterScriptsDedupFiltered