C1 W3 Logistics regression excercise 3 and 6

Machine Learning: Regression and classification week 3 practice lab exercise 3 and 6.

Coursera verified my code for both exercises and it matches identically to what they have on their end as the correct answers, however when i run both of the exercises the expected outputs are incorrect which leads to the AsseritionError: AssertionError: Wrong value for dj_db for both.

I have triple checked my code, and i just dont understand what is going on. I checked the coding in the hints, and re-ran them and reset the lab many times. I am going crazy. someone please help

If you pass one set of tests, but fail a different test, the thing to check for is some form of “hard-coding”. E.g. are you sure that within the body of your function you only reference the parameters declared in the definition of the function, as opposed to directly referencing the global variables that are passed as arguments in the test case? Or hard-coding assumptions about the dimensions of the objects is another type of error that can cause this kind of failure.

To state it in a high level way, what is happening is that your code is not “general”: it passes one test case, but fails other test cases. So the code must be written in such a way that it is making assumptions that are too specific to the first test case.

I am not an avid python coder, but do code in other languages, and i honestly dont see where the error is. Coursera confirmed the coding was correct - and it matches the hints, is there any way to get someone to look at the code to help me move forward? i have spent way too much time on this, and the error is probably something mundane

Sure, the rules are that we aren’t supposed to share code in a public thread, but there are ways to share code privately. Please check your DMs for a message from me about how to do that. You can recognize DMs in your “feed” by the little envelope icon.

1 Like