MATLAB Answers

rong tao

nftool. Why thet test set chosen by matlab behaves better than my own test set.

Asked by rong tao
on 9 Nov 2019
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
I trained using Matlab's with the ratio given above.
[net,tr] = train(net,inputs,response)
And split my data and feed 80% of the data into the inputs.
trainx = dataset(1:floor(S*0.8),1:batch_size*6);
trainy = dataset(1:floor(S*0.8),batch_size*6+1);
mytestx = dataset(1+floor(S*0.8):end,1:batch_size*6);
mytesty = dataset(1+floor(S*0.8):end,batch_size*6+1);
Then I get the test set chosen by matlab and my own test set and calculate their R^2
tInd = tr.testInd;% inputs chosen by matlab to be the test set
fitedy = net(inputs(:, tInd));
The matlab test set behaves way better than my own test set.
Some times, I even get 0.6 R^2 with my own test set getting minus R^2 values, could some one explain why?


Sign in to comment.

0 Answers