Error in c_statistic on test data

My c_statistic function works correctly out of UNQ_C8.

But when run against the test data there is an exception thrown. That is in this cell…
tmp_cstat_test = c_statistic(rr_lr, y_test, X_test.TRTMT)
print(f"Logistic Regression evaluated by C-for-Benefit: {tmp_cstat_test:.4f}")

Debugging the above, here is what I find…

For some strange reason the y_test shape is (152,) as is the X_test.TRTMT shape also (152,) which is correct. But I can return values of only y_test[2] and X_test.TRTMT[2]. All others such as y_test[0] and X_test.TRTMT[0] throw an exception.

@Mubsi or other mentors. Please help

Are the parameters… y_test, X_test.TRTMT pandas dataframes or numpy arrays? How should I access them - index or rownum?


My bad. Should have posted the lab ID in the first place. Here it is…


Take a look at your notebook now.

Cool! I was implementing the “zip” function, not having seen the Hints :wink: Nothing wrong with that except that I was zipping on rownum, not on index.

Thanks @Mubsi .