1

I receive ValueError: No data provided for "lstm__input". Need data for each key in: ['lstm__input'] while executing lime::explain

I have latest lime version and looked thourgh all related topics 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't with objects of class 'array', 'double', 'numeric' so I can't use it. Has anyone faced such issue? How can I fix it?

humanhater
  • 11
  • 2

0 Answers0