“UNQ_C3, C5, C6 all fail with: ValueError(‘Event times and predictions must have the same shape’). My util.py cindex is: return lifelines.utils.concordance_index(y_true, scores). C1, C2, C4 all pass. What is wrong with holdout_grid_search?”
Risk Models Using Tree-based Models
"UNQ_C3, C5, C6 all fail with: ValueError(‘Event times and predictions must have the same shape’). My util.py cindex is:
return lifelines.utils.concordance_index(y_true, scores)
. C1, C2, C4 all pass. What is wrong with holdout_grid_search?"
Hi. Please pick the right course to post this topic. From the code, it seems like this is for AI for Medicine. Thanks.
1 Like
Though @chris.favila is right, you need to pick the right course while posting your question, I am still going to try to help you out here.
Print y_true.shape and scores.shape right before the return statement in util.py.
The lifelines.utils.concordance_index expects one-dimensional arrays. If your model output is coming back as a 2D array (e.g., shape (n, 1)) while your labels are a 1D Series (shape (n,)), it will not work. You can use .flatten() or .squeeze() on your predictions before passing them to the cindex function inside your utility file or the search function.
1 Like
@AREPRADEEPTHI_2025
please post screenshot of submission grader output which provides information on why you failed a particular exercise.
You have created two place topics, i replied you on the other thread @AREPRADEEPTHI_2025