Search code examples
matlabneural-networkbias-neuron

Find accuracy of neural network application result


I couldn't find anything useful about accuracy of results in neural network,

  1. I run character recognition example in Matlab, after network training and simulation by input test, how can I compute accuracy of output result after simulation?

  2. for some reasons(Research) after network training I want to change some neuron weights and simulate by input test then how can I compute its output accuracy compared to exact output result? and Is this task possible in neural network,

Thanks in advance for any help.


Solution

  • When you train a network using something like [net,tr] = train(net,x,t) where net is a configured network, x is an input matrix, and t is a targets matrix, the second returned argument tr is the training record. If you just display tr on the console you get something that looks like

    tr = 
    
        trainFcn: 'trainlm'
      trainParam: [1x1 struct]
      performFcn: 'mse'
    performParam: [1x1 struct]
        derivFcn: 'defaultderiv'
       divideFcn: 'dividerand'
      divideMode: 'sample'
     divideParam: [1x1 struct]
        trainInd: [1x354 double]
          valInd: [1x76 double]
         testInd: [1x76 double]
            stop: 'Validation stop.'
      num_epochs: 12
       trainMask: {[1x506 double]}
         valMask: {[1x506 double]}
        testMask: {[1x506 double]}
      best_epoch: 6
            goal: 0
          states: {1x8 cell}
           epoch: [0 1 2 3 4 5 6 7 8 9 10 11 12]
            time: [1x13 double]
            perf: [1x13 double]
           vperf: [1x13 double]
           tperf: [1x13 double]
              mu: [1x13 double]
        gradient: [1x13 double]
        val_fail: [0 0 0 0 0 1 0 1 2 3 4 5 6]
       best_perf: 7.0111
      best_vperf: 10.3333
      best_tperf: 10.6567
    

    which has everything about the training results. Matlab has some built in functions for operating on this record, the most useful of which I find to be:

    plotperform(tr) - plot performance calculated by performFcn in tr

    plotconfusion(t,y) - plots confusion matrix which is a very concise graphical display of how your network misclassified things, and shows percentages of correct/incorrect in each class as well as total. t is the targets matrix and y is the computed output, which you can extract using y=net(x) for x input matrix.