Negative output neural networks

Illustration
david_s - 2021-07-16T10:14:13+00:00
Question: Negative output neural networks

I trained my neural network, but it generates negative values even though the target values are positive. I wonder why ?  

Expert Answer

Profile picture of John Williams John Williams answered . 2025-11-20

the output of the neural network depends on the transfer function of the output layer, if the results are negative you probably have a transfer function like "tansig" or "purelin", I recommend that if you don't want negative values you should change the transfer function, if the answer is in the range from 0 to 1 you can change it to "logsig" or whatever function you desire :
 
 
net.Layers{end}.transferFcn='logsig';


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!