https://github.com/nixtla logo
#mlforecast
Title
# mlforecast
r

Rehan Javed

06/15/2023, 11:14 AM
Hi #mlforecast, I am new to mlforecast and trying to get feature importance for LGBM model in mlforecast but cant find any documentation. The code looks like this. Has anyone done like this before ? fcst = MLForecast( models=[ lgb.LGBMRegressor(**model_params)], #xgb.XGBRegressor(**model_params)], freq='M', # include 6 monthly lags lags=[1,2,3,4,5,6], # create a feature for year and month date_features=['year','month'], lag_transforms={ 1: [expanding_mean, # add 1 period lag for the mean (expanding over the window) (rolling_mean,3), # add 1 period lag for 3 month rolling mean (rolling_mean,6), # add 1 period lag for 6 month rolling mean ] }, target_transforms=[StandardScaler()], # transform to z-score normalized )
j

José Morales

06/16/2023, 5:03 AM
Hi. After you fit the models they're available on the
MLForecast.models_
dict, so in your particular example I believe you can use
fcst.models_['LGBMRegressor']
and can access the attributes like feature importance
r

Rehan Javed

06/19/2023, 12:16 PM
thanks - is this library a wrapper around sklearn library ?
j

José Morales

06/20/2023, 1:06 AM
It leverages the sklearn api to train the models and compute predictions
r

Rehan Javed

06/20/2023, 8:41 AM
thank you @José Morales 🙂 for your quick messages and support