MATLAB: A DIFFICULT NEURAL NETWORK

data partitionfoldneural network

i need help on how to design the followin network, i ll appreciate some code since i am raelly new on both NN and matlab thanx in advance
0)i got 50 4x1 matrices that i wanna target to 1 and 0 (50 data)
1) i use 35 to train the network 15* to test
2)i take these 35 data and split them into 7 folds of 5 data each, lets say:
i=1,..,n=7 from that 7 fold i pick a random fold to test/validate and keep the rest to train the network and i do this 7 times for each fold
3) so now i have created 8 networks: the original and onother 7 due to the data partition i made

Best Answer

Did you correct my numbering so that the second 2 is 3 and the 4 is 5?
MSEtrn00 = mean(var(ttrn',1))
MSEgoal = MSEtrn00/100
MinGrad = MSEtrn00/300
rng(0)
for h = Hmin:dH:Hmax % e.g., 1:10

for n = 1: Ntrials % e.g., 1:10
net = patternnet(xtrn,ttrn,h);
net.divideFcn = 'dividetrain';
net.trainParam.goal = MSEgoal;
net.trainParam.min_grad = MinGrad;
[net tr ] = train(net,xtrn,ttrn);
bestepoch = tr.best_epoch;
R2(n,h) = 1 - tr.perf(bestepoch)/MSEtrn00;
end
R2 = R2
% The goal is R2 >= 0.99. Find the smallest h to yield acceptable results.
For variance updating check a statistics book or work it out yourself. The mean updating is given by
meanx(i+1) = meanx(i) + [x(i)-meanx(i)]/(i+1)
Hope this helps.
  • Thank you for formally accepting my answer*
Greg