C1_W1 test_logistic_regression unit test failed

I got Logistic regression model’s accuracy = 0.9950 which matches the expected output. However, the following unit test fails with

*Wrong accuracy value. *

  • Expected: 1.0.*
  • Got: 0.005.*
  • 3 Tests passed*
  • 1 Tests failed*

what could be the cause of this?

If you passed one test, but failed another test or tests, it means that your code is not general. Something about it must be “hard-coded” to match the one test that it passes. Please have a look at the code with that idea in mind and let us know if you find anything.

It might help to read the source code for the test that you fail to understand what is different about it. You can do that by opening the file w1_unittest.py. Click “File → Open” and then have a look around.

2 Likes

Notice that the test case you fail takes freqs and theta as inputs. So also make sure you run all the cells in order and don’t insert any extra code that messes with those values between the first test and the ones you fail.

thx for the prompt reply! Indeed I forgot to change back one hard-coded parameter during testing to what it should be. Once I made the change, it passes the unit test! Thanks again!

1 Like