Fix post-outcome data leakage in StageNet mortality/LOS tasks - #1205
Open
lehendo wants to merge 1 commit into
Open
Fix post-outcome data leakage in StageNet mortality/LOS tasks#1205lehendo wants to merge 1 commit into
lehendo wants to merge 1 commit into
Conversation
lehendo
commented
Aug 25, 2026
Collaborator
- MortalityPredictionStageNetMIMIC4: exclude diagnosis/procedure codes for the admission that ends in death, and cap that admission's labs to the first 48 hours after admission instead of through discharge. Earlier, already-resolved admissions are unaffected
- LengthOfStayStageNetMIMIC4: same treatment for the target admission (the one whose LOS is the label)
diagnoses_icd/procedures_icd events are timestamped at dischtime (per the MIMIC-IV config), so for the admission whose own outcome is being predicted, those codes are only known at-or-after the outcome. Labs were also pulled through discharge/death for that same admission. - MortalityPredictionStageNetMIMIC4: exclude diagnosis/procedure codes for the admission that ends in death, and cap that admission's labs to the first 48 hours after admission instead of through discharge. Earlier, already-resolved admissions are unaffected. - LengthOfStayStageNetMIMIC4: same treatment for the target admission (the one whose LOS is the label). Both changes only affect the single outcome-adjacent admission per patient; prior history is untouched. Reported metrics on these two tasks are expected to drop after this fix -- the previous numbers were inflated by the leak, not a legitimate baseline. Verified end-to-end against real MIMIC-IV demo data: terminal/target admission codes are excluded, late labs near the outcome are dropped, early labs and all prior-admission data are preserved, and patients whose only admission is the terminal/target one are correctly excluded (no leak-free signal available), matching the existing convention in dka.py.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.