MATLAB: Difference between trainInd values obtained during ANN training

retrieve datasettrainind

Hi
I am training a dataset (4×53) consisting of 2 hidden layers using newff command in matlab 2014a.
Below is the script:
[trainInd,valInd,testInd] = dividerand(P,0.7,0.15,0.15);
net=newff(P,T,[8 4],{ 'tansig' 'logsig'})
net=train(net, P,T);
I used the command in line1 to retrieve the data used in testing such that training=4×37, validation=4×8 and test=4×8.
I also used another command: testdata=P(:,tr.testInd) to extract the testing data. However on using the latter command i got matrices with following size: training=4×32, validation=4×6, testing=4×2
So i wanted to know the reason for this discrepancy.
Below are the subset indices:
trainInd: [2 4 5 6 7 8 9 10 11 12 13 14 16 17 18 19 20 21 22 24 25 26 27 29 30 31 33 34 37 38 39 40]
valInd: [1 3 15 32 35 36]
testInd: [23 28]
In the above i cannot see data from 41 to 53 being used for training, validation or testing? can any body explain the reason
Thank you

Best Answer

You created trainInd, valInd, and testInd, but you did not set the corresponding properties of net. Have a look at http://www.mathworks.com/matlabcentral/answers/93318-how-do-i-divide-up-my-data-using-specified-indices-when-using-the-train-function-in-the-neural-netwo and notice that the net.divideFcn property has to be set along with net.divideParam parameters
It appears to me that you extracted a subset of your data and sent that to training, but that because you had not set up the parameters ahead of time it assumed that the data was the data that needed to be divided up.