我一直在通过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']
答案 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)
}