Hello,
I have trained neural network using nnet
in caret
in R. I am seeking few suggestions.
- Is there a way to plot loss vs iteration/epoch.
- The nnet documentation, page 5, suggests that training stops when criteria is satisfied (abstol and reltol). Is there a way to check how many iterations were performed.
- In nnet document, page 5, the stopping criteria : abstol = 1e-4 should stand for absolute tolerance and reltol = 1e-8 should stand for relative tolerance. What does these terms mean ?
- Is there a way to know the batch size used during training. I cannot see information on batch size used during training.
- I could save model after each epoch while training in keras, is there a way to save weights of network after each epoch/iteration in nnet used in caret.
Attached a sample code, ready to run -
library(tidyverse)
library(nnet)
library(caret)
# data
x <- c(0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1)
y <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1)
choice <- c(1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1)
tbl <- tibble(x, y, choice)
tbl$choice = as.factor(tbl$choice)
myControl <- trainControl(## n-fold CV
method = "repeatedcv",
number = 2,
repeats = 5,
verboseIter = TRUE)
nnGrid <- expand.grid(size = 2,
decay = seq(0, 0.1, 0.1))
nnetFit <- train(choice ~ .,
data = tbl,
method = "nnet",
tuneGrid = nnGrid,
trace = FALSE,
maxit = 6000,
trControl = myControl)
Thanks