MATLAB: Neural Networks – Simple question

backpropagationDeep Learning Toolboxdividefcnfeedforwardneural network toolboxneural networks

What is the difference between 'dividerand' and 'divideint' ??

Best Answer

1.Read the command line documentation:
help dividerand
doc dividerand
type dividerand % If you have permission

and
help divideint
doc divideint
type divideint % If you have permission
My naive interpretation:
dividerand: randomly rearranges the integers 1:N ( e.g., with randperm) and with the default ratios 0.7/0.15/0.15, assigns the last Ntst = round(0.15*N) to the test set, the middle Nval = round(0.15*N) to the validation set and the first Ntrn = N - Nval - Ntst to the training set.
Example: choose a value for N and numtrials
N = 30
numtrials = 10
rng(0) % Initialize the RNG so that the example can be duplicated
for n =1:numtrials
[trnind,valind,tstind] = dividerand(N,0.7,0.15,0.15) % no semicolon
end
divideint: assigns members of the three sets to be as interleaved as possible. For example, if N = 30 then Nval = Ntst = round(0.15*30) = 5 and Ntrn = 20. I don't know the algorithm used by MATLAB (you can check type divideint) but, you could choose the spacing of valind and tstind to be uniform (e.g., = 6), and starting with a number in 1:6.
Hope this helps.
Thank you for formally accepting my answer
Greg