training nnet in caret. Seeking few suggestions

Hello,

I have trained neural network using nnet in caret in R. I am seeking few suggestions.

  1. Is there a way to plot loss vs iteration/epoch.
  2. 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.
  3. 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 ?
  4. Is there a way to know the batch size used during training. I cannot see information on batch size used during training.
  5. 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

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.