marcotcr / lime

Lime: Explaining the predictions of any machine learning classifier
BSD 2-Clause "Simplified" License
11.64k stars 1.81k forks source link

number exception when using LIME with LightGBM native API #682

Open 123Kudo opened 2 years ago

123Kudo commented 2 years ago

Situation:

  1. saving lime explainer using dill during training and loading it back during prediction.
  2. the model is light gbm native api predict - so wrapped it as below

def predict_fn(x): p = gbm.predict(x).reshape(-1, 1) return np.hstack((1-p, p))

  1. use it as below within a try except block

test = explain_df.iloc[0, :].values logger.info(test.shape) exp = explainer.explain_instance(test, predict_fn)

Exception:

  1. exception is a number 267 without other information

Any suggestion on where shall I dig into ?