C1_W3_Assignment - UNQ_C4 - issue with calculating dice_coefficient

Hello Eveyone,

for some reason, my dice_coefficient calculation is not correct and i can not figure out the error. All the test for UNQ_C3 passed, so i am assuming, i have calculated UNQ_C3 (single_class_dice_coefficient) correctly.

I get following error,

Test Case 1:

Pred:

[[1. 0.]
 [0. 1.]]

Label:

[[1. 1.]
 [0. 0.]]

Dice coefficient:  1.5000012499968751 

----------------------

Test Case 2:

Pred:

[[1. 0.]
 [0. 1.]]

Label:

[[1. 1.]
 [0. 1.]]

Dice coefficient:  1.8000003999992 

----------------------

Test Case 3:

Pred:

class = 0
[[1. 0.]
 [0. 1.]] 

class = 1
[[1. 0.]
 [0. 1.]] 

Label:

class = 0
[[1. 1.]
 [0. 0.]] 

class = 1
[[1. 1.]
 [0. 1.]] 

Dice coefficient:  2.300001649996075 

Error: Wrong output for Test Case 1. One possible reason for error: make sure epsilon = 1
Error: Wrong output for Test Case 2. One possible reason for error: make sure epsilon = 1
Error: Wrong output for Test Case 3. One possible reason for error: make sure epsilon = 1
 4  Tests passed
 3  Tests failed
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-44-1c5027f51497> in <module>()
      6 ### do not edit anything below
      7 sess = K.get_session()
----> 8 dice_coefficient_test(dice_coefficient, epsilon, sess)

~/work/W3A1/public_tests.py in dice_coefficient_test(target, epsilon, sess)
    266     ]
    267 
--> 268     multiple_test_dice(test_cases, target, sess)
    269 
    270 ##############################################

~/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 dice_coefficient. Check your equations and avoid using global variables inside the function.

can you please help me to figure out my error? my LAB-ID is bdzejbuzrhoa.

please ignore it. i solve the problem. i was getting confused with axis and then instruction by saying use mean to calculate average and giving dice_denominator=None.