There are different manners to divide whole data into Training Set, Validation Set and Test Set using dividind.
divideind Divide targets into three sets using specified indices Syntax [trainInd,valInd,testInd] = divideind(Q,trainInd,valInd,testInd) Description [trainInd,valInd,testInd] = divideind(Q,trainInd,valInd,testInd) separates targets into three sets: training, validation, and testing, according to indices provided. It actually returns the same indices it receives as arguments; its purpose is to allow the indices to be used for training, validation, and testing for a network to be set manually.
1 – Divide the data by index so that successive samples are assigned to the training set, validation set, and test set successively:
trainInd = 1:3:201; valInd = 2:3:201; testInd = 3:3:201; [trainP,valP,testP] = divideind(p,trainInd,valInd,testInd); [trainT,valT,testT] = divideind(t,trainInd,valInd,testInd);
2 – Divide using net which, in this example, assumes our neural network:
p = [0 1 2 3 4 5 6 7 8; 0 1 2 3 4 5 6 7 8]; t = [0 0.84 0.91 0.14 -0.77 -0.96 -0.28 0.66 0.99]; net = newff(p,t,5) net.divideFcn = 'divideind'; net.divideParam.trainInd = 1:2:9; net.divideParam.valInd = 2:2:9; net.divideParam.testInd = 2:2:9;