0

伙计们,

当尝试从提供了验证框架的检查点模型恢复 R 中的 h2o 深度学习时,我遇到了一些问题。它说“验证数据集必须与检查点模型相同”,我相信我确实有相同的验证数据集。如果我将validation_frame 留空,则检查点模型可以正常工作。我在下面附上我的代码:

localh2o <- h2o.init(nthreads = -1)
train_image.hex <- read.csv("mnist_train.csv",header=FALSE)
train_image.hex[,785] <- factor(train_image.hex[,785])
train_image.hex <- as.h2o(train_image.hex)
test_image.hex <- read.csv("mnist_test.csv",header=FALSE)
test_image.hex[,785] <- factor(test_image.hex[,785])
test_image.hex <- as.h2o(test_image.hex)


mnist_model <- h2o.deeplearning(x=1:784, y = 785,
training_frame= train_image.hex, 
validation_frame = test_image.hex,
activation = "RectifierWithDropout", hidden = c(500,1000),
input_dropout_ratio = 0.2,
hidden_dropout_ratios = c(0.5,0.5), adaptive_rate=TRUE,
rho=0.98, epsilon = 1e-7,
l1 = 1e-8, l2 = 1e-7, max_w2 = 10, 
epochs = 10, export_weights_and_biases = TRUE,
variable_importances = FALSE
)
h2o.saveModel(mnist_model, path="/tmp",force=TRUE)

然后我关闭了 h2o,退出 R 并在 R 中重新启动 h2o 以恢复训练,其中 h2o 错误:

localh2o <- h2o.init(nthreads = -1)
train_image.hex <- read.csv("mnist_train.csv",header=FALSE)
train_image.hex[,785] <- factor(train_image.hex[,785])
train_image.hex <- as.h2o(train_image.hex)
test_image.hex <- read.csv("mnist_test.csv",header=FALSE)
test_image.hex[,785] <- factor(test_image.hex[,785])
test_image.hex <- as.h2o(test_image.hex)
startmodel <- h2o.loadModel("/tmp/DeepLearning_model_R_1443812402059_20", localh2o)

mnist_model <- h2o.deeplearning(x=1:784, y = 785,
checkpoint = startmodel@model_id,
training_frame= train_image.hex, 
validation_frame = test_image.hex,
activation = "RectifierWithDropout", hidden = c(500,1000),
input_dropout_ratio = 0.2,
hidden_dropout_ratios = c(0.5,0.5), adaptive_rate=TRUE,
rho=0.98, epsilon = 1e-7,
l1 = 1e-8, l2 = 1e-7, max_w2 = 10, 
epochs = 10, export_weights_and_biases = TRUE,
variable_importances = FALSE
)
4

2 回答 2

0

请使用最新版本重试。现在应该可以了。

于 2017-03-29T20:55:22.137 回答
0

感谢您向我们指出这一点。我添加了一个 JIRA,你可以在这里跟踪它的进度:https ://0xdata.atlassian.net/browse/PUBDEV-2182

您可以期待问题很快得到解决。

谢谢!

阿维尼

于 2015-10-02T21:53:10.360 回答