我想用插入符号中的 nnet 训练具有一个隐藏层的浅层神经网络。在 trainControl 中,我使用 method = "cv" 执行 3 折交叉验证。剪切的代码和结果摘要如下。
myControl <- trainControl(## 3-fold CV
method = "cv",
number = 3)
nnGrid <- expand.grid(size = seq(1, 10, 3),
decay = c(0, 0.2, 0.4))
set.seed(1234)
nnetFit <- train(choice ~ .,
data = db,
method = "nnet",
maxit = 1000,
tuneGrid = nnGrid,
trainControl = myControl)
我有几个疑问 -
结果(附在下面)表明它执行的是引导(25 次重复)而不是交叉验证(我接受的模型只针对每组超参数的 3-cv 训练了 3 次)。
我只想 100% 确定模型是否使用原始数据进行训练,而无需任何预处理,例如居中和缩放。
我在 trainControl 中使用了 verboseIter = FALSE,但它仍然打印所有迭代
其他库(例如神经网络、mxnet)是否比 nnet 更好,我可以在这里替换它们。
我想确定 nnet 是否在隐藏层中使用 sigmoid 激活函数。
有人可以建议吗?
No pre-processing
Resampling: Bootstrapped (25 reps)
Summary of sample sizes: 3492, 3492, 3492, 3492, 3492, 3492, ...
Resampling results across tuning parameters:
size decay Accuracy Kappa
1 0.0 0.4947424 -0.002382083
1 0.2 0.5686601 0.141749447
1 0.4 0.5711497 0.143637446
4 0.0 0.5076199 0.022765002
4 0.2 0.7333516 0.468625768
4 0.4 0.7253675 0.452584882
7 0.0 0.5002912 0.006079340
7 0.2 0.7440360 0.488933678
7 0.4 0.7676500 0.536547080
10 0.0 0.5064281 0.013648966
10 0.2 0.7668795 0.535370693
10 0.4 0.7566465 0.513652332
Accuracy was used to select the optimal model using the largest value.
The final values used for the model were size = 7 and decay = 0.4.