1

我收到 ValueError:没有为“lstm__input”提供数据。在执行lime::explain时需要每个键的数据:['lstm__input']

我有最新的石灰版本,并查看了与我的问题相关的所有主题。我有 LSTM 回归网络,训练和预测值没有任何问题。同样,我使用石灰预测值也没有任何问题:

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)

到目前为止,一切正常。当我尝试运行下一行时:

explanation <- lime::explain (
    testX, 
    explainer    = explainer, 
    n_features   = 4)

我收到一个错误:

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))

我想主要问题来自这样一个事实,即我的 NN 只需要 3-dim 矩阵predict_model在不能使用它。有没有人遇到过这样的问题?我该如何解决?

4

0 回答 0