HI I am using a fully connected network that uses sigmoid if we feed a a big enough weights the sigmoid function will finally become 1 or 0 , is there any solution to avoid this ?

and will this lead to classical sigmoid problems vanishing gradient or exploding gradient ?

Thank you

New contributor
hbdz is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • $\begingroup$ Increase precision to 256 bit if you are really desperate to use sigmoid. Else use different activation. $\endgroup$ – DuttaA Sep 11 at 14:54
  • $\begingroup$ DuttaA I think I am stuck with the use of sigmoid(since I am looking for a probability ) but I wonder how to increase the precision to 256 what do you mean by that ? $\endgroup$ – hbdz Sep 11 at 15:15
  • 1
    $\begingroup$ Normal libraries use 64 bit precision for calculations. But if it is required you can increase precision thus avoiding a complete 0 gradient at the trade-off for memory and speed. But if you need probablity use softmax instead, and in the mid layers use relu. $\endgroup$ – DuttaA Sep 11 at 15:55
  • $\begingroup$ The other problem is when using sigmoid in an FNN with more than 1 hidden layer is that backpropagation degrades and weights in the first layer will only be updated by small values that might not have a significant impact. Relu fixes this problem. I agree with @DuttaA use softmax if you want to get a probability. $\endgroup$ – SandMan Sep 11 at 17:01
  • $\begingroup$ Can you elaborate on the task you're intending to solve with your network? As others have already said, ReLUs are the best option in intermediate layers and it's probable that you could do with logit (pre-sigmoid) outputs instead of going through the sigmoid for backprop purposes. $\endgroup$ – David Sep 11 at 17:43

Your Answer

hbdz is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.