MATLAB: How to train a neural network to 0.1 error rate

neural network

Hello,
I have written this code to train a neural network with 500 samples as the inputs and 32 attributes.Its a classification problem and i have two classes in the target.
net=fitnet(30,'trainlm');
net.divideParam.trainRatio=.7;
net.divideParam.valRatio=.15;
net.divideParam.testRatio=.15;
[net,tr] = train(net,input500',target500');
Output=net(sample')';
the code is working although the output of the sample isn't perfect yet. I need explanation on how i can calculate error rate after each epoch. Also i want the neural network to continue its training until the error rate is less than 0.1 Please how can i achieve this. Thanks in anticipation.

Best Answer

1. Error rate cannot be used as a training function because it is discontinuous.
2. PATTERNNET, the current default classification/pattern-recognition function, is more appropriate than FITNET which is designed for regression/curve-fitting. See the documentation
help patternnet
doc patternnet
2. For examples, search BOTH the NEWSGROUP and ANSWERS using
greg patternnet
3. For c classes, the c x N target matrix is obtained from the true class indices 1:c via IND2VEC. The estimated class indices are obtained from the output via VEC2IND. Class error rates are obtained by comparing true and estimated indices.
4. Since it is impossible to directly design for a given error rate, the best approach is, for a given number of hidden nodes, H, make multiple (e.g., Ntrials = 10) designs using different random initial weights.
5. To get a feel for it, start with default value H = 10. Then, use a for loop over H = Hmin:dH:Hmax to try to obtain the smallest value of H that will yield acceptable results. You will have to design at least
Ndesigns = Ntrials*numel(Hmin:dH:Hmax)
6. See previous posts and write back if you need help.
Hope this helps,
Thank you for formally accepting my answer
Greg