Code is correct, but, seems global var is causing a problem?

code is correct, but, seems global var is causing a problem? I didn’t change anything else other than adding line of codes between start/end code block.

AssertionError: Not all tests were passed for sigmoid_derivative. Check your equations and avoid using global variables inside the function.

{edited by mentor}

Hello, @kmng,

First, if we look at the printout below:

image

we can see that the function was not getting the right answer for sigmoid(1). In fact, you might calculate the right answer yourself using the formula below provided in the assignment:

image

Therefore, the first thing is to make sure the formula is correctly implemented for your solution.

Next, your message mentioned that there was an assertion error for sigmoid_derivative but your screenshot was showing another error for basic_sigmoid. I think you have done the right thing by looking at basic_sigmoid first because it was used in sigmoid_derivative and if the former was not correct, the latter would also not be correct.

Good luck, @kmng!

Cheers,
Raymond

PS: we shouldn’t share our work publicly, but please don’t worry as I have removed that part for you. I replaced it with just the error traceback which is what you might share next time when needed.

1 Like

Hello Raymond, it’s working now! Thanks!
the error msg about global var confused my debug focus.

1 Like

That’s good news that it’s working!

Thanks for letting me know, @kmng :wink:

Raymond