AI in medical diagnosis W3 assignment issues

so i am working on my C1_W3 assignment , i keep getting the same assertion error and the same 3 test cases failed for the past 3 days . i would like someone to please help me with this i am due today at 12 am !

1 Like

I am not a mentor but I advise that you post screenshots of the tests that fail and also give more information for the mentors to work with.

1 Like

Hello @bhavana_bathini,

Can you share screenshot of the three test cells you failed without sharing any codes. Kindly take a screenshot rather than copy and paste.

Regards
DP


the test cases passed but it keeps throwing attribute error

1 Like

tensorflow is imported as tf so is keras as k , one of my friend suggests that it maybe the tensorflow environment that is giving the problem

1 Like

I have not taken that course and so have no idea about the contents of that assignment, but just as a programmer there is a pretty obvious error there in the invocation of the soft_dice_loss_test function there. Notice that the order of the last two arguments is opposite from the definition of the function shown in the next level of the exception trace. That will not end well …

I can’t tell if that test code is something that you wrote or changed though. In DLS they sometimes make the test cells “not editable”.

1 Like

so you have used keras right? for these exercises?? as these assignment require you to use keras

1 Like

Hello @bhavana_bathini,

Notice you first error mention with the keras backend that is related to exercise cell 3. Basically it is stating an attribute which had to be recalled in cell 3 and which is used in cell 5 as default does not exist as integer, so it is throwing this attribute error.

To solve the error, make sure the value is of the expected type before accessing the attribute.

I hope you have read this instruction before exercise cell 3 and following :point_down:

please use the Keras.sum(x,axis=) function to compute the numerator and denominator of the dice coefficient.

if you don’t get the solution, share the codes for exercise cell 3, 4 and 5 by screenshot image through personal DM. Do not post codes here.

I am sorry for delay in response, not keeping well. Click on my name and then message.

Regards
DP

there is a problem there as well if i don’t change the order 3 tests are not passing , but if i do those tests pass but i am receiving an attribute error

1 Like

yes …yes i did use keras , i have imported it in the first cell(pre existing code)

1 Like

thank you for the solution . it is still throwing the attribute error. i shall dm you with the screenshots.

1 Like

Hello @bhavana_bathini,

You have hard coded all the codes in UNQ3, 4, 5. Keep it simple the way it was given at the beginning. define your codes with numerator, denominator and the recalled function such as dice cofficient, dice loss. While hard coding, there is an error done as the rules of BODMAS got affected due to incorrect tuple placement in UNQC3, extra tuppling in UNQC4 and a important error in dice loss as you defined dice loss as K.mean of incorrect dice loss which only had numerator and denominator.

Do not hard code the path.

Regards
DP

Hello @bhavana_bathini,

without recalling dice_numerator with a function code and if you use it in dice_loss, you will get the error of not defined.

Your update code correction is incorrect, you are still hard coding.

Kindly write the codes with only 3 statement i.e. I AM SHARING IMAGE CODE SCREEN FOR UNQ C3, 4, 5

whatever you are writing separately for true and pred values seems to be correct but that when mentioned in the intersection which you created is causing these errors. Another error you are doing while implementing this stepwise code into numerator and denominator, you are creating error by incorrect tupling, for example in case of dice_loss, one needs to apply 1 - K.mean of whole of numerator by denominator, but you have first recalled dice_loss with 1.0 - numerator/denominator, and then you have recalled k.mean of dice_loss, creating the assertion error. for other grader cell UNQ3 and 5 also the same mistake has happened.

Regards
DP

I completed the course . Thankyou so much , couldn’t have done it without your help !!!

Hello @bhavana_bathini,

So you did the debugging yourself, that’s great.

Happy Learning!!!

Regards
DP