Test_compute_loss fails in my assignement

Hi everyone,

In my assignement:

UNIT TEST

test_compute_loss(compute_loss)

The routine checks like the first 3 tests but in the 4 test it says:

Test MSE with parameters A = 0 and B = 1

AssertionError: Wrong value. Expected 0, got 0.9436175227165222

Any idea what would be wrong? y_targets is a numpy array

Hi @mamartinb
welcome to our community!
Make sure that you implemented the code correctly, and you used the parameters that send to you to make your code generalize over test cases, Note that you can check the hint below

Best Regards,
Abdelrahman

The most common issue here is making the code much more complicated than you need.

Check these two points from the instructions:

Study item 1) first, it gives you a very important trick. It lets you avoid using any if-statements.

With that trick you only have to implement the 2) equation. The part of 2) that is highlighted in yellow is given to you by the starter code, you don’t have to write that part.

So the code you have to write is really just one fairly simple bit of algebra to implement equation 2). You’ll use the variables rewards, gamma, done_vals, and max_qsa.

Dear TMosh, thank you so much for your advice! I solved it in just one line of code, just very compact and elegant! I also found another mistake in the code that produced the error in the picture I sent you this week… I do not why I used the GAMMA spelling instead of gamma… :wink: Anyway, thanks and greetings from Colombia

All names in Python are case-sensitive. So gamma and GAMMA would be two totally different variables.