Error after exercises in Predicting Pts risk reduction

All tests passed for all exercises, but when running provided code to calculate patients risk reduction , Im receiving the following error, but I didn’t edit the cells:


TypeError Traceback (most recent call last)
in ()
1 # Use the t-learner to predict the risk reduction for patients in the validation set
----> 2 rr_t_val = t_learner.predict(X_val.drop([‘TRTMT’], axis=1))
3
4 print(f"X_val num of patients {X_val.shape[0]}“)
5 print(f"rr_t_val num of patient predictions {rr_t_val.shape[0]}”)

in predict(self, X)
39
40 # the predicted risk reduction is control risk minus the treatment risk
—> 41 pred_risk_reduction = risk_control - risk_treatment
42
43 ### END CODE HERE ###

TypeError: unsupported operand type(s) for -: ‘NoneType’ and ‘NoneType’

I’m not a mentor for that course.

But check whether you completed the code in predict().

Hi @Tayler-Frances_Chapm ,

Based on the error message you mentioned, I assume that it appears that the variables “risk_control” and “risk_treatment” have not been edited.
The message says that both variables have the None type object.

Firstly, I kindly recommend you review the mentioned part and ensure that the necessary modifications have been made to the variables.

Best regards,
Nakamura

Got it! Thank you so much!

i have a similar issue, but a different error. can anyone help me figure it out. thanks

kvkjmrltnvoc here is my lab. the above solution didn’t work for me.

I figured it out, turns out it was indeed a similar solution, problem with how i implemented the predict code. thanks guys, great work @deeplearning.ai