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

Laura · Jun 1, 2021 · 2K views
Question
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. You have one target class, if M>0.5 assign to class 1. Else, do not (equivalent to assign to class 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. if M>0.8 assign to class 1, else class 2.Incidentally, (this is not the main question) would this be equivalent to 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
Expert Answer
Profile picture of John Michell
John Michell PhD Expert
Answered Aug 24, 2026
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
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!