Task Contribution: Dynamic Survival Analysis for Early Event Prediction#1036
Open
rbradley813 wants to merge 47 commits intosunlabuiuc:masterfrom
Open
Task Contribution: Dynamic Survival Analysis for Early Event Prediction#1036rbradley813 wants to merge 47 commits intosunlabuiuc:masterfrom
rbradley813 wants to merge 47 commits intosunlabuiuc:masterfrom
Conversation
…ockPatient (visits dict structure)- Support dict-based patients- Support PyHealth dataset (latest main)- All tests pass (20/20)- Example script runs successfully
…example runs successfully
… MIMIC (expire_flag, dod)- Enable real event generation (previously all censored)- Update DynamicSurvivalTask label construction- Fix input/output schema for tensor pipeline
…ing on task configurations
…ee new tests at end
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.
Dynamic Survival Analysis for Early Event Prediction
Contributors: Skyler Lehto (lehto2), Ryan Bradley (ryancb3), Weonah Choi (weonahc2)
Description
Implements a standalone
DynamicSurvivalTaskbased on:The task reformulates early event prediction as a discrete-time survival problem with multiple anchor points. Instead of fixed-horizon binary classification, it produces hazard-based predictions across a configurable prediction horizon.
Key features:
fixed,single)Files
Core implementation:
pyhealth/tasks/dynamic_survival.py— task implementationpyhealth/tasks/__init__.py— export registrationTests:
tests/core/test_dynamic_survival.py— unit tests including edge casesExamples:
examples/mimic_dynamic_survival_gru.py— end-to-end example with GRU modelexamples/dynamic_survival_ablation.py— ablation experimentsexamples/mock_ehr.py— mock EHR data generation utilitiesexamples/synthetic_dataset.py— synthetic dataset for fast CI testingDocs:
docs/api/tasks.rst— updated indexdocs/api/tasks/pyhealth.tasks.dynamic_survival.rst— API reference pageConfig:
pyproject.tomlrequirements.txtReproducibility / Setup
Primary (pyproject.toml):
pip install -e .Fallback (conda environment):
Due to cross-platform compatibility issues (e.g., cross-platform issues such as PyTorch wheels on Intel Mac), a stable fallback setup is provided using conda +
requirements.txt:Run tests:
Run example: