MATLAB: How to change the outputs of the neural network that the error function receives

Deep Learning ToolboxMATLABneural networkneural networkstutorial

Given a neural network with 2 output classes there are 2 ways of assigning its real-valued output, M in [0,1], to binary classes.
  1. You have one target class, if M>0.5 assign to class 1. Else, do not (equivalent to assign to class 2).
  2. You have two target classes. If M_{1} > M_{2} assign to class 1, else assign to class 2.
I would like my output to be biased s.t.
  1. if M>0.8 assign to class 1, else class 2.Incidentally, (this is not the main question) would this be equivalent to
  2. If 0.2*M_{1} >0.8*M_{2} assign to class 1, else class 2.
I can change the final outputs in this way. However, I am running the network through some loops and I would like my changes to be recognised within the network's architecture. It is right that the error function minimises some sort of distance (perhaps least squared) between the output, M, and the target, y? In my case it will be minimising the distance between the old, unmodified output, rather than my threshold adjusted output. Do you know how I can tell the error function about this new output? Many thanks for any help

Best Answer

The classical approach for c classes is to minimize Bayesian Risk R given prior probabilities Pi (i=1:c), classification costs Cij>= 0, Cii = 0 and input conditional probability densities p(i|x).
R = sum(i=1:c)( Pi*Ri ) % Total Risk
Ri = sum(j=1:c){Cij*p(j|x)} % Risk of ith class being misclassified
Hits from searching classification costs with and w/o greg
comp.ai.neural-nets 49 128
MATLAB Newsgroup 15 32
MATLAB Answers 2 6
Applications to the BioID data. Search using BioID
comp.ai.neural-nets 3
MATLAB Newsgroup 5
MATLAB Answers 1
Hope this helps.
Greg