applying k-fold with Artificial Neural Network
3 views (last 30 days)
Show older comments
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
1 Comment
Greg Heath
on 4 Oct 2015
Edited: Greg Heath
on 4 Oct 2015
The fastest way to get help is to
1. use the classification/pattern-recognition function
help patternnet
doc patternnet
2. Apply your code to one or more of of the MATLAB classification/pattern-recognition datasets
help nndatasets
doc nndatasets
Greg
Accepted Answer
Greg Heath
on 4 Oct 2015
Edited: Greg Heath
on 4 Oct 2015
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
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!