Skip to content

Commit

Permalink
more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoroller committed Dec 11, 2024
1 parent bfad67b commit ad53a17
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/torchsurv/loss/cox.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def _partial_likelihood_cox(
"""Calculate the partial log likelihood for the Cox proportional hazards model
in the absence of ties in event time.
"""
log_denominator = torch.logcumsumexp(log_hz_sorted.flip(0), dim=0).flip(0)
log_hz_flipped = log_hz_sorted.flip(0)
log_denominator = torch.logcumsumexp(log_hz_flipped, dim=0).flip(0)
return (log_hz_sorted - log_denominator)[event_sorted]


Expand Down

0 comments on commit ad53a17

Please sign in to comment.