cross validation in neural network

F
faizan_malik · Apr 21, 2022 · 2K views
Question
i need some clarification on cross validation to be applied to neural network. i manage to get result of NN. right now i plan to apply cross validation for model selection.   i have go through example of *crossvalind, crossval* but i dont really understand what is classifier,in other word, what are the main things to be considered in order to apply cross validation.    
Expert Answer
Profile picture of John Michell
John Michell PhD Expert
Answered Aug 28, 2026
What do you mean by "model selection" ... making a choice between newrb and fitnet(regression) or patternnet(classification)? Or, given one of them with one hidden layer, choosing the minimum number of hidden nodes that can achieve the design goal?
 
I do not have crossvalind and haven't figured out how to use crossval for neural nets yet.
 
If I were in a hurry, I would just use randperm(N) to randomly divide the N cases of input/target pairs into 10 mutually exclusive subsets. Then use subset i (i=1:10), for testing, subset j (j ~= i) for validation and the remaining eight subsets for training. There is no need to shuffle data around because it can all be done with indexing.
 
With 10-fold XVAL there are 10*9 = 90 combinations for validation and test subset pairs. However, only 10 are needed. Therefore, there is no need to use both combinations (i,j) and (j,i). This reduces the number to 45. However, since the subsets are random, it is sufficient to use j = mod(i+1,10).
 
I would then tabulate the separate train/val/test performances as well as their summary statistics.
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!