MATLAB: Applying k-fold with Artificial Neural Network

neural networks

I am trying to employ k-fold with my neural networks. I have a 13 features from 1000 images. (13 *1000 ) dataset , I am trying to see whether 5-fold would agree to the ANN to give better results. I have the body of ANN as next inputs = Z1; targets = c; hiddenLayerSize =60; net = feedforwardnet(hiddenLayerSize); % Train the Network [net,tr] = train(net,inputs,targets); y = net(inputs); perf = perform(net,targets,y);
%%%%%%%%%%%%% %%%%%%% for testing from the same data which trained%%%%%%% testZ1 = inputs(:,tr.testInd); testC = targets(:,tr.testInd); testY = net(testZ1); testYclasses = testY > 0.5; %% to get 0 or 1
[k,cm] = confusion(testC,testY); %you to understand correctly
outputs = net(inputs); errors = gsubtract(targets,outputs); performance = perform(net,targets,outputs);
Z2; q = net(Z2); g; q) testqClasses = q > 0.5 ; [w,wm] = confusion(g,q) ;
fprintf('Percentage Correct train Classification : %f%%\n', 100*(1-a)) fprintf('Percentage Incorrect train Classification : %f%%\n', 100*a)
fprintf('Percentage Correct test Classification : %f%%\n', 100*(1-w)) fprintf('Percentage Incorrect test Classification : %f%%\n', 100*w)
How can i implement 5 k fold on the ANN code. Thank for helping

Best Answer

Search BOTH the NEWSGROUP and ANSWERS using
greg cross validation
greg crossvalidation
greg cross-validation
Check the newest posts first.
Hope this helps.
Greg
PS Also try adding the term TUTORIAL