chk.H2OFrame(x)中的错误:必须是H2OFrame

时间:2016-12-09 10:57:49

标签: r deep-learning h2o

我已经运行了h2o deeplearning并获得了如下模型

best_model<- h2o.deeplearning( activation = "RectifierWithDropout",
                                            hidden = c(200, 200, 200, 200, 200),
                                            hidden_dropout_ratio = c(0.1, 0.1, 0.1, 0.1, 0.1),
                                            loss = "CrossEntropy",
                                            l1 = 1e-5,
                                            epochs = EPOCHS,
                                            distribution = "multinomial",
                                            seed = 5000,
                                            balance_classes = TRUE,
                                            y = c("Churn"),
                                            x = columns,
                                            validation_frame = churn_validation,
                                            training_frame = churn_training

                                            )

现在我尝试用我的测试数据来测试它

churn_prediction <- h2o.predict(best_model, my_test)

我收到此错误:

Error in chk.H2OFrame(x) : must be an H2OFrame

有什么建议吗?

编辑:文档中的示例似乎工作正常

library(h2o)
h2o.init()
iris.hex <- as.h2o(iris)
iris.dl <- h2o.deeplearning(x = 1:4, y = 5, training_frame = iris.hex)

# now make a prediction
predictions <- h2o.predict(iris.dl, iris.hex)

1 个答案:

答案 0 :(得分:2)

总结上面的评论(答案):my_test必须是H2O框架。您可以通过hf <- as.h2o(my_test)将其从R data.frame转换为H2OFrame,或者如果您使用my_test <- h2o.importFile("test.csv")从磁盘加载数据,则它必须是H2OFrame而无需从R内存中复制。< / p>