Correct me if I’m wrong, but for this dataset I thought that treated patients have a label of 1 and untreated patients have a label of 0.

Why then is the expected output of this function 0.6?

To get this output, untreated samples have to be filtered with x[2] == 1 (the treated patient label) and treated samples have to be filtered with x[2] == 0 (the untreated label).

Shouldn’t we be filtering the untreated samples with x[2] == 0 and treated samples with x[2] == 1?

If I do it this way, which seems like the correct way, then the output of the test function is actually 0.4 instead of 0.6.

Please advise

1 Like

What you are thinking is right. And it is okay if your expected output has a little change. your assignment will have the marks.

1 Like

Hi,

I have the same question : I get to an output of 0.6 instead of the expected 0.4.

As a result the unit test is not passing (because `Wrong output`

, makes sense), and the evaluation of Logistic Regression further down is 0.4588 instead of the expected 0.5412.

The grader also says `Code Cell UNQ_C8: Function 'c_statistic' is incorrect. Check implementation.`

and the point is not given.

The answer given here does not sound right, and there is a real issue in the way I’ve implemented my code, but I can’t see it…

Could you maybe help shed some light on this @Mubsi ?

1 Like

I identified my mistake thanks to @Mubsi. `c_for_benefit`

is built to take as argument:

`pairs`

(list of tuples): each element of the list is a tuple of individuals, the **first** from the **control** arm and the **second** from the **treatment** arm."

and I was doing the opposite when building pairs at the end of `c_statistic`

…

P.S.: my previous post has a typo and should read:

I get to an output of **0.4** instead of the expected **0.6**.

2 Likes

Same issue here. I’m getting 0.4 not 0.6.

Hi @neurofire80,

How have you zipped the tuples, the order matters, if you have zipped in different order then it have shown wrong output. While filtering the tuples your use as x[2] == 0 for untreated patients and x[2] == 1 for treated patients is only true if you have zipped it correctly. Provide me your order of zipping pred_rr, y, w. There might be the problem present.

Regards,

Harsh Der.

I am getting the same issue.

tuples = [(i,j,k) for i,j,k in zip(pred_rr, y, w)]

```
# Collect untreated patient tuples, stored as a list
untreated = [x for x in tuples if x[2] == 0]
# Collect treated patient tuples, stored as a list
treated = [x for x in tuples if x[2] == 1]
```

This should be correct, however the test fails. When I flip untreated to X[2] == 1 and treated to x[2]==0, the test passes.