C4_W1_Assignment: UNQ_C10 mbr_decode : Test looks dubious

I have put “print” statements all over a copy of test “test_mbr_decode.”
I have printed out the expected value and the actual output. They seem to match except for 1 case I have “iss” instead of “esse.” I pass 3 out of 4 tests. And I don’t get any credit for the three tests that I passed by the tester. Please help and explain. Double-click on the image to see it in full screen.

All these collective scenarios make one unit test. You have to pass all of them in order to pass the unit test. Failing one of them means there’s something not right in your code.

Do let know if you need help anymore with this exercise.

Thank you for your response, @Mubsi . Yes, even though I have passed the test on a high note, for my own edification, I would like to know what I did wrong. Can I zip and upload the script to you or someone else?

Arald was not correctly implementing to retrieve the key with the highest score, which was why the unit test was failing.

@Mubsi, Great news!
Thank you for looking.
Can you be a little more specific?

I am experiencing an unexpected test failure with “test mbr_decode” as well. The test passes if the similarity function is changed from from jaccard_similarity to rouge1_similarity in the call to w1_unittest.test_mbr_decode(), so it seems the problem is with the test.

Hi @foobar ,

You can copy the test function test_mbr_decode() into a different copy of the assignment just to debug.

Changing the code at the end of the assignment from

w1_unittest.test_mbr_decode(target=mbr_decode, score_fn=average_overlap, similarity_fn=rouge1_similarity)

to

w1_unittest.test_mbr_decode(target=mbr_decode, score_fn=average_overlap, similarity_fn=jaccard_similarity)

fixes the problem with the test. Beyond that, I was not able to spot any issue with my own code.

Another thing is that the ‘You have completed the assignment!’ string gets mistranslated but this can also be fixed by changing the similarity function to jaccard from rouge1.

Did you write print statement in the code copy and the test code copy. To track down where the problem is.