Hi, the exercise is about calculating the sigmoid derivative. I have implemented the function as:

def sigmoid_derivative(x):

s = 1/(np.exp(-x))

```
ds = s*(1-s)
return ds
```

I think am making the mistake while calculating “ds”. I am getting 2 tests passed and 1 test failed message when I run the code.

Any suggestions what could be the issue here?

Thanks

Your implementation of the derivative is correct, but the s value that you feed into it is wrong. Why reimplement *sigmoid* manually here? You already built the function to compute that earlier, so why not save yourself some work by just calling it? But if you insist on building it again, at least compare your current implementation to the previous one. I hope the previous one is different.

Your implementation of s is:

s = \displaystyle \frac {1}{e^{-x}}

But note that is equivalent to:

s = e^x

right? That’s a little different than *sigmoid*, no?

1 Like

Also,

One quick way to debug these is to find the values of the different variables for different values. We know that the value at infinity (or a very high value) is 1 and the derivative at infinity is 0.

By checking the function, you can see that these are not followed.

1 Like

definitely calling the sigmoid function (already implemented) is the better approach. Thanks for the suggestion.