Derivative of sigmoid

前端 未结 4 700
闹比i
闹比i 2021-02-02 11:00

I\'m creating a neural network using the backpropagation technique for learning.

I understand we need to find the derivative of the activation function used. I\'m using

相关标签:
4条回答
  • 2021-02-02 11:37

    Dougal is correct. Just do

    f = 1/(1+exp(-x))
    df = f * (1 - f)
    
    0 讨论(0)
  • 2021-02-02 11:40

    You can use the output of your sigmoid function and pass it to your SigmoidDerivative function to be used as the f(x) in the following:

    dy/dx = f(x)' = f(x) * (1 - f(x))
    
    0 讨论(0)
  • 2021-02-02 11:49

    A little algebra can simplify this so that you don't have to have df call f.
    df = exp(-x)/(1+exp(-x))^2

    derivation:

    df = 1/(1+e^-x) * (1 - (1/(1+e^-x)))
    df = 1/(1+e^-x) * (1+e^-x - 1)/(1+e^-x)
    df = 1/(1+e^-x) * (e^-x)/(1+e^-x)
    df = (e^-x)/(1+e^-x)^2
    
    0 讨论(0)
  • 2021-02-02 11:55

    The two ways of doing it are equivalent (since mathematical functions don't have side-effects and always return the same input for a given output), so you might as well do it the (faster) second way.

    0 讨论(0)
提交回复
热议问题