Add event-free survival evaluation

This commit is contained in:
2026-06-27 11:48:47 +08:00
parent df6b45b95a
commit 3cd1109249
6 changed files with 2568 additions and 47 deletions

View File

@@ -200,19 +200,7 @@ def _build_first_occurrence_maps(
def _get_death_token_ids(dataset: HealthDataset) -> List[int]:
ids: List[int] = []
exact_codes = {"death", "<death>", "dth", "deceased", "mortality"}
for token, code in dataset.label_id_to_code.items():
token = int(token)
if token in SPECIAL_TOKENS:
continue
text = str(code).strip().lower()
if text in exact_codes or ("death" in text) or ("mortality" in text):
ids.append(token)
death_ids = sorted(set(int(x)
for x in ids if int(x) not in SPECIAL_TOKENS))
death_ids = [int(dataset.vocab_size) - 1]
print(f"[INFO] death token ids: {death_ids}")
return death_ids