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

Dimnames issue in explain command #140

Closed asheetal closed 5 years ago

asheetal commented 5 years ago

I am using keras with cntk backend, continuous output value regression. The error happens when I use explain function. Complaining that the dimnames are not correct in the test dataframe. Any suggestions? Below is the traceback stack. Both train and test are dataframes with exactly same number of named columns. Test has only one observation.

">"explanation <- lime::lime(x=train, model=model, bin_continuous = FALSE, quantile_bins=FALSE) ">" lime::explain(test, explanation, n_features=2) Error in dimnames<-.data.frame(tmp, value = list(n)) : invalid 'dimnames' given for data frame ">" traceback() 13: stop("invalid 'dimnames' given for data frame") 12: dimnames<-.data.frame(tmp, value = list(n)) 11: dimnames<-(tmp, value = list(n)) 10: as.array.default(newdata) 9: as.array(newdata) 8: is_tensorflow_dataset(x) 7: resolve_tensorflow_dataset(x) 6: predict.keras.engine.training.Model(x, as.array(newdata)) 5: predict(x, as.array(newdata)) 4: predict_model.keras.engine.training.Model(explainer$preprocess(explainer$model), case_perm, type = o_type) 3: predict_model(explainer$preprocess(explainer$model), case_perm, type = o_type) 2: explain.data.frame(test, explanation, n_features = 2) 1: lime::explain(test, explanation, n_features = 2)

MathieuMarauri commented 5 years ago

Hello,

I am having similar issue following this code. Everything went well when using it on images but here it throws the dimnames error.

Thanks for this package, I am exploring it and I am finding it really useful and powerful.

Cheers, Mathieu

turgut090 commented 5 years ago

@asheetal , @MathieuMarauri
look at the end of #447