R-Keras Churn教程-py_call_impl(可调用,dots $ args,dots $ keywords)错误:ValueError:没有为“ dense_1_input”提供数据

时间:2018-07-15 08:07:03

标签: r tensorflow keras rstudio

我一直在通过Keras(Tensorflow)示例进行流失预测,并在下面一行遇到错误。

Error in py_call_impl(callable, dots$args, dots$keywords) : 
  ValueError: No data provided for "dense_1_input". Need data for each key in: ['dense_1_input']

我得到的错误是

Error in py_call_impl(callable, dots$args, dots$keywords) : 
  ValueError: No data provided for "dense_1_input". Need data for each key in: ['dense_1_input']

1 个答案:

答案 0 :(得分:2)

万一其他人有问题,可以通过将newdata更改为as.matrix(newdata)来解决

# Setup lime::predict_model() function for keras
predict_model.keras.models.Sequential <- function(x, newdata, type, ...) {
  pred <- predict_proba(object = x, x = as.matrix(newdata))
  data.frame(Yes = pred, No = 1 - pred)
}