AI4M Course 3 Week 1 UNQ_C6 unexpected output

Hi,

I’m stuck at exercise 6 here from Course 3 Week1 assignment. Here is my test output.

	ARR
0.129032	0.089744
0.117647	0.042857
0.372093	-0.014604
0.446602	0.122222
0.583333	0.142857
0.633333	-0.104072
0.588235	0.150000
0.750000	0.293706
0.800000	0.083333
0.900000	0.200000
Expected output
baseline_risk
0.231595    0.089744
0.314713    0.042857
0.386342   -0.014604
0.458883    0.122222
0.530568    0.142857
0.626937   -0.104072
0.693404    0.150000
0.777353    0.293706
0.836617    0.083333
0.918884    0.200000
Name: ARR, dtype: float64

Here you can see I got the correct calculation for ARR. However, I didn’t get the output index correct. Based on the exercise, the output index is set by average baseline risk of each risk group using ALL patients. To do this, I used

df.groupby('risk_group')['y'].mean().values

Could anyone please help out and see what I did wrong?

Thanks

Huan

Hi @MrHuanwang,

You are not considering the baseline risk mean here.

Best,
Mubsi

Oh. I see. THANKS!!!