C3_W1: quantile_benefit error with TLearner predictions shape

rr_t_val = t_learner.predict(X_val.drop(['TRTMT'], axis=1)) has shape (foo, 2) which when passed to quantile_benefit as arr_hat, throws exception at this line:

df.loc[:, 'benefit'] = arr_hat

hello @khteh

my first question would be have you passed all the previous! grade function unittest? as the error is pointing your label shape don’t match with features shape, check the c-statististics where is error probably. Check how you sorted the untreated and treared patients.

The hint given for both condition is
Use sorted(some_list, key=lambda x: x[1]) to sort a list of tuples by their value in index 1.

But while sorting indexing value should be 0.

Yes, I sorted it by using index 0, which is pred_rr in the tuple. c_statistic_test(c_statistic) pass.

1 Like

please DM me screenshots of previous two grade functions with the t learner grade function codes screenshots. Click on my name and then message.

hi @khteh

the way you are predicting the death using the control estimator and treatment estimator is incorrect. you are just using the dataframe, where you are suppose to use the dataframe with the condition if death occurs in those conditions.

here is a thread i explained recently about the same which should help you understand your code issue

understanding condition column position

let me know if you still have issue.

regards
DP

1 Like