我用h2o
(如下)构建了一个简单的深度学习回归模型。该模型预测R虹膜数据集中的萼片长度。我注意到,随着我增加时期,模型精度(r^2)增加(图1)。时代如何影响深度学习模式?
通过增加时代的数量,我会过度拟合以有害的方式模型还是我增加一个有益的方式模型的准确性?
library(datasets)
library(h2o)
df <- iris
df.hex <- as.h2o(df)
model <- h2o.deeplearning(x = 2:5, y = 1, df.hex,
hidden = c(200, 200, 200, 200, 200),
epochs = 5,
variable_importances=T)
perf_dl <- h2o.performance(model)
rsq_dl <- h2o.r2(perf_dl)
图1
# Note this code plots the data from the deep learning runs in the previous code
library(ggplot2)
df <- data.frame(epochs = c(5, 10, 100, 300, 500, 1000, 2000, 3000, 5000), rsq = c(0.77, 0.70, 0.57, 0.75, 0.87, 0.92, 0.97, 0.96, 0.98))
p <- ggplot(df, aes(epochs, rsq))
p + geom_point(aes(size = 7)) + stat_smooth(method = "lm", formula = y ~ x + I(x^2), size = 1)
这是一个很小的玩具数据集,你无法通过在其上运行实验来真正判断学习的深度。你有5个隐藏层,每个人有更多的神经元比数据集有行。这不是一个好的用例。 – TomKraljevic