C2_W4_Exercise 3 - harrell_c

Hello,

Hello,

I’m having some difficulty computing the Harrel’s C-index for Exercise 3. I looked through previous topics but haven’t identified a solution. Screenshots for both the traceback and output errors are below as a reference. I would appreciate some guidance if possible. Many thanks in advance.

Cheers

1 Like

such error only comes when most of the learners have made changes to the instructions already given in the grade cell and one either tries to hard code the path, not following the grade cell argument and instead recall codes with general variables.

Because of previous experience, I try to make it a point not to alter the instructions. That said, I have encountered errors due to spacing. Is it possible to locate a clean copy? I remember coming across one of your previous posts on how to reset a lab. Would that be applicable here?

yes use the same instruction to get fresh copy.

let me know if you still getting failed test.

1 Like

Unfortunately, I am still getting the same errors despite the refreshed lab. I will continue to chip way and see if I can get lucky.

ok @LC25

it time to see your codes probably. please click on my name and then message to send screenshot of the grade cell codes.
Regards
DP

hi @LC25

for code line

check for concordant, your elif condition is incorrectly correlated for true event times and model risk scores.

if true event times i > j and score i< j, same way way

if true event time i< j and score i >j. (You mixed up the > and < for the concordant conditions)

next for code line for event
check if one is censored, you are suppose to check
elif event[i] != event[j] (Here your code is incorrect)

after this where you check if these event are permissible where you check if uncensored true event is less than or equal to the censored true event.

then check if uncensored scores is absolute equal to the censored scores(you mentioned these in reverse)

after this to check if scores are concordant, the only condition you need to use was
if uncensored score is greater than censored scores (here you do not require to check event times again as it was checked up in the earlier loop statement.

Also just a pointer when you are mentioning the score value mention them as 1.0 as the result c metric is a float value.

1 Like

Thank you so much! I appreciate your help as I continue to stumble my way through. Cheers!

1 Like