thomasp85 / lime

Local Interpretable Model-Agnostic Explanations (R port of original Python package)
https://lime.data-imaginist.com/
Other
486 stars 110 forks source link

Exactly with same data GBM&Lime explain() works fine, but failing for RandomForest and CRF with NA/NaN/Inf in 'y' #172

Open j-ghatak opened 4 years ago

j-ghatak commented 4 years ago

Hi All,

I am using lime and with GBM it works fine (though had to create model_type.gbm and predict_model.gbm, as there is no direct support for GBM and new observation is actually on same training data) but EXACTLY with the same data when I am trying apply to RandomForest and CRF (another version of RandomForest), the following error is showing up.

Any explanation/solution will be highly appreciated.

Note:

  1. The data and model details are copyrighted, so can not publish any detail but open for question and can provide some generic information(if required) without divulging any company specific information.

  2. For testing/new data I have used couple of rows of the same training data , for simplification purpose

  3. The ACTUAL train and test data surely contains NA value, factor value, numeric values, but in this case, there is NO NA values within the data and converted/curated all data types to numeric in type and class.

  4. For GBM also, when I use test data, it fails (currently train and test data DOES NOT contains NA, all data is numeric

The following is the error message (which is generic)

explanation <- explain(local_obs, explainer, n_labels = 1, n_features = 5) Error in glm.fit(x = x_fit, y = y, weights = weights, family = gaussian()) : NA/NaN/Inf in 'y' In addition: Warning messages: 1: In gower_work(x = x, y = y, pair_x = pair_x, pair_y = pair_y, n = NULL, : skipping variable with zero or non-finite range 2: In gower_work(x = x, y = y, pair_x = pair_x, pair_y = pair_y, n = NULL, : skipping variable with zero or non-finite range 3: In gower_work(x = x, y = y, pair_x = pair_x, pair_y = pair_y, n = NULL, : skipping variable with zero or non-finite range 4: In gower_work(x = x, y = y, pair_x = pair_x, pair_y = pair_y, n = NULL, : skipping variable with zero or non-finite range 5: In gower_work(x = x, y = y, pair_x = pair_x, pair_y = pair_y, n = NULL, : skipping variable with zero or non-finite range 6: In gower_work(x = x, y = y, pair_x = pair_x, pair_y = pair_y, n = NULL, : skipping variable with zero or non-finite range 7: In Ops.factor(y, mu) : ‘-’ not meaningful for factors 8: In Ops.factor(eta, offset) : ‘-’ not meaningful for factors 9: In Ops.factor(y, mu) : ‘-’ not meaningful for factors