Skip to content

Commit

Permalink
corrected c-score
Browse files Browse the repository at this point in the history
  • Loading branch information
derrynknife committed Mar 31, 2023
1 parent 0039c91 commit 5169dd0
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions surpyval/utils/score.py
Expand Up @@ -78,21 +78,24 @@ def predict(i, x, Z):
x_hat_1 = predict(i_1, x_1, Z_1)
x_hat_2 = predict(i_2, x_2, Z_2)

if x_1 < x_2:
if x_hat_1 < x_hat_2:
if x_1 != x_2:
if x_hat_1 > x_hat_2:
concordance += 1
elif isclose(x_hat_1, x_hat_2, abs_tol=tie_tol):
concordance += 0.5
elif x_1 == x_2:
if c_1 == 0 and c_2 == 0:
if isclose(x_hat_1, x_hat_2, abs_tol=tie_tol):
concordance += 1
else:
concordance += 0.5
else:
concordance += 0.5
else:
# x_1 == x_2 and one is a death
if (c_1 == 0 and x_hat_1 < x_hat_2) or (
c_2 == 0 and x_hat_2 < x_hat_1
):
concordance += 1
else:
concordance += 0.5
if c_1 == 0 and x_hat_1 > x_hat_2:
concordance += 1
elif c_2 == 0 and x_hat_2 > x_hat_1:
concordance += 1
else:
concordance += 0.5

return concordance / n_permissible_pairs

Expand Down

0 comments on commit 5169dd0

Please sign in to comment.