Skip to content

Commit

Permalink
enhance _iter_comparable loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Maladiere authored and sebp committed Jul 3, 2024
1 parent 03566f6 commit 97bcb63
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sksurv/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,14 @@ def _iter_comparable(event_indicator, event_time, order):
# check for tied event times
event_at_same_time = event_indicator[order[i:end]]
censored_at_same_time = ~event_at_same_time

mask = np.zeros(n_samples, dtype=bool)
mask[end:] = True
# an event is comparable to censored samples at same time point
mask[i:end] = censored_at_same_time

for j in range(i, end):
if event_indicator[order[j]]:
mask = np.zeros(n_samples, dtype=bool)
mask[end:] = True
# an event is comparable to censored samples at same time point
mask[i:end] = censored_at_same_time
tied_time += censored_at_same_time.sum()
yield (j, mask, tied_time)
i = end
Expand Down

0 comments on commit 97bcb63

Please sign in to comment.