I DON’T UNDERSTAND WHY ONLY ONE TEST PASSED
# GRADED FUNCTION: basic_sigmoid
Mentor edit: code removed
I DON’T UNDERSTAND WHY ONLY ONE TEST PASSED
# GRADED FUNCTION: basic_sigmoid
Mentor edit: code removed
I’m not sure which course or assignment your query belongs to, as the basic_sigmoid exercise is not part of the Deep Learning Specialization Course 2. But your sigmoid implementation is wrong. The correct formula is:
g(x) = \frac{1}{1+e^{-x}}
You are doing this:
g(x) = e^{x}
In the future please do not share your code on the forum. That’s not allowed by the Code of Conduct.
ok. thank you.
Posting a screen capture image of the error messages or test results is usually sufficient to diagnose the problem.
If a mentor needs to see your code, we’ll contact you directly with instructions.
ok. thank you
Yes, as it was in this case. We can see that the return value you got for sigmoid(1) is e^1 = 2.71828.... For starters, that can’t possibly be correct, since the output values of sigmoid are between 0 and 1, right? If you are puzzled that you passed one test, note that frequently the tests here will first check the type of the output. You passed that test because your return value is a scalar floating point value, but that’s a pretty low bar. Then the second test is that they check the actual value of the answer and that is incorrect, as we realized above.
If you are curious, you can examine the test logic by clicking “File → Open” and then open the file public_tests.py and find the particular test function that is being invoked in a particular test.