C3_W1_Assignment # UNQ_C5

Lab ID: gtizubcyvtpv

I get a wrong shape and wrong output. What I have done is set all ‘TRTMT’ vales to false and run the predict_proba.

This is the output I get:

Base risks for both rows should be the same.
Baseline Risks: [[0.56884132 0.43115868]
[0.56884132 0.43115868]]

Error: Wrong shape.
Error: Wrong output.
1 Tests passed
2 Tests failed

@Mubsi @nakamura


Hi @getjaidev,

In this particular unit test, the test data has 2 rows, where one of them has TRMT as true and the other as TRMT as false. What you are doing is, first getting the row where TRMT is true, and setting it to false. Then you are using that particular row to calculate base risk.

You are using DataFrame’s at function, which only gets you one row, but you need to get both rows so that the base risk can be calculated for both rows, check out the loc function instead.

More detail is left in your notebook.

Hope this helps,

Thanks @Mubsi . So the basic problem was the fact that the “at” vs the “loc”. Got it!

Lab ID: eappwyhbnstd
Why are there two TRTMT columns in Test Case 1? Why are the values of the Test Case TRTMT column mixed type? Why is the TRTMT column type of X_dev “bool”, but the TRTMT column type of X “object”?

Going by the question, any method that forces all TRTMT values to False should solve this, but that’s not the case. Why does no assertion of zero values pass the “base_risks_test”? Even forcing the coefficient to zero fails.

#X['TRTMT'] = np.array([0,0])
#X['TRTMT'] = np.where(X['TRTMT'] == 1, 0, X['TRTMT'])
#X[X.TRTMT == 1] = 0
#X.loc[:, 'TRTMT'] = 0
#x_map = {1:0}
#X.replace(({'TRTMT':x_map}), inplace=True)
#lr_model.coef_[0][7] = 0


Bumping as it’s been two days. @Mubsi @getjaidev @harshder03 @carlsaez Thanks

Hey @gerald_wrona

Hope you are doing well.

I had a slightlly different problem. It was that of two rows, but I picked up only one, which is a more realistic problem to have than yours!

Your problem seems to be a dataframe with two columns named the same. I am not quite sure why that is so, but if genuine dupes, it seems like a good case for preprocessing actually, both on training and test.

As for mixed types this should be fixed in preprocessing as well. Looks like an inconsistency more than an error since True is 1 and False is 0. But needs to be fixed nevertheless.

@Mubsi can anyone who can access Gerald’s lab snd the original lab design look into this. I cant really make out if this was by design or inadvertent.

Best Regards.

– Jaidev

Thanks Jaidev. I agree with your analysis. Do you see any way for me to complete the lab in its current state? Is there anyone else I should reach out to for support?

Hi @gerald_wrona,

I shall take a look.

Hi @gerald_wrona,

Your issue has been fixed. You can take a look in your lab for more details.


Thank you both

Hi Mubsi,
i guess i have the same problem. Could you help me?
My lab is gyzivagmwgow

Hi @Alberto_Zacchini,

Check your notebook now!

1 Like