C1_W3_Assignment: UNQ_C5

I keep getting this error message. Can anyone help at spotting what I did wrong/give any solution?

Test Case 6:

Soft Dice Loss: 0.4375

Error: Wrong output for Test Case 2. One possible reason for error: make sure epsilon = 1
Error: Wrong output for Test Case 4. One possible reason for error: make sure epsilon = 1
Error: Wrong output for Test Case 5. One possible reason for error: make sure epsilon = 1
9 Tests passed
3 Tests failed

AssertionError Traceback (most recent call last)
in ()
6 ### do not edit anything below
7 sess = K.get_session()
----> 8 soft_dice_loss_test(soft_dice_loss, epsilon, sess)

~/work/W3A1/public_tests.py in soft_dice_loss_test(target, epsilon, sess)
412 ]
413
→ 414 multiple_test_dice(test_cases, target, sess)
415
416 ##############################################

~/work/W3A1/test_utils.py in multiple_test_dice(test_cases, target, sess)
183 print(‘\033[92m’, success," Tests passed")
184 print(‘\033[91m’, len(test_cases) - success, " Tests failed")
→ 185 raise AssertionError(“Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target.name))

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

My code was:

(Solution code removed, as posting it publicly is against the honour code of this community, regardless if it is correct or not)

Hello Yosilia,

Kindly remove the codes from your post. It is against community guidelines. You can always share a screenshot of your error or your output in comparison to the expected output.

  1. Have you noticed that DO NOT EDIT?? …there is no import statement for UNQ_C5 cell. You have edited the grader cell, which will lead you to grader failure when you submit your assignment.

  2. If you have read these instructions before the cell

We’ve explained the single class case for simplicity, but the multi-class generalization is exactly the same as that of the dice coefficient.

  • Since you’ve already implemented the multi-class dice coefficient, we’ll have you jump directly to the multi-class soft dice loss.

you will understand you need to define the dice_loss as per the K.mean instructions, but before that recall dice_numerator and dice_denominator where you would use K.sum for your predictive and true labels with axis and the epsilon factor.

Your codes are incorrect for UNQ_C5 and if you have followed the same code pattern for C4, then you need to correct them too.

Regards
DP