Hello,
I trained a NNET model in R and want to apply a nested 10-fold cross-validation. Then, I want to report average performance metrics (accuracy, precision, F1, recall, AUC) for each fold. The code of the model is as follows:
set.seed(123)
test$group = factor(test$group, levels = c("DLD", "TD"))
index <- createDataPartition(test$group, p = 0.8, list = FALSE)
training_data <- test[index, ]
testing_data <- test[-index, ]
#k-cross validation
ctrl <- trainControl(method = "cv", number = 10, verboseIter = TRUE)
hyperparameters <- expand.grid(size = seq(from = 1, to = 10, by = 1), decay = seq(from = 0.001, to = 0.1, by = 0.1))
grid_search_result <- train(group ~ perception + rtperception + vocabulary + morphosyntax + repetition, data = training_data, method = "nnet", trControl = ctrl, tuneGrid = hyperparameters, maxit = 100, MaxNWts = 500)
Can someone help me with the code?
George