lime
lime copied to clipboard
No data provided for “lstm__input” in “explain” function
I have latest lime
version and looked thourgh all related topics (like #105) to my problem. I have LSTM regression network and I don't have any issues training it and predicting values. As well I don't have any problems predicting values using lime
:
class(model) #keras.engine.sequential.Sequential
model_type.keras.engine.sequential.Sequential <- function(x, ...) {
"regression"}
predict_model.keras.engine.sequential.Sequential <- function (x, newdata, type, ...) {
pred <- predict(object = x, x = newdata)
data.frame (pred) }
predict_model(x = model, newdata = (testX_Matrix), type = 'raw')
explainer <- lime::lime (
x = trainX,
model = model,
bin_continuous = FALSE)
Up to this point everything works fine. When I try to run next lines:
explanation <- lime::explain (
testX,
explainer = explainer,
n_features = 4)
I receive an error:
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: No data provided for "lstm_8_input". Need data for each key in: ['lstm_8_input']
Detailed traceback:
File "C:\Soft\anaconda\envs\R-TENS~1\lib\site-packages\keras\engine\training.py", line 1147, in predict
x, _, _ = self._standardize_user_data(x)
File "C:\Soft\anaconda\envs\R-TENS~1\lib\site-packages\keras\engine\training.py", line 749, in _standardize_user_data
exception_prefix='input')
File "C:\Soft\anaconda\envs\R-TENS~1\lib\site-packages\keras\engine\training_utils.py", line 77, in standardize_input_data
'for each key in: ' + str(names))
I guess main problem comes from the fact that my NN requires only 3-dim matrix (the same I used in predict_model
), but lime doesn't work with objects of class 'array', 'double', 'numeric' so I can't use it.
I don't know, whether it's a bug or I'm missing something, but I can't move on in my project without solving this issue.
I don't think I can be of any help without a reproducible example to try out