Repository navigation
Conversation
Test CoverageTotal: 86.81% (49198 / 56672 lines)
|
|
/review |
| from sksurv.nonparametric import CensoringDistributionEstimator | ||
| from sksurv.util import Surv | ||
|
|
||
| from pyhealth.datasets import Support2Dataset |
There was a problem hiding this comment.
[medium] SUPPORT2 example reuses Support2Dataset without the description naming it
The example imports and uses the existing PyHealth Support2Dataset (line 25, used at line 37). This creates a link to another concrete dataset component. The PR description does not mention this reuse; only the markdown results file does, and a markdown file does not count as the description. Either confirm the sharing in the PR description and say why (for example, to reproduce the benchmark with the standard SUPPORT2 loader), or keep the example self-contained by loading the CSV directly and deriving the features and outcomes in the script. Both options are acceptable.
|
|
||
| from pyhealth.datasets import Support2Dataset | ||
| from pyhealth.models import DeepCoxMixtures | ||
| from pyhealth.tasks import SurvivalTimeToEventSupport2 |
There was a problem hiding this comment.
[medium] SUPPORT2 example reuses SurvivalTimeToEventSupport2 task without the description naming it
The example imports the existing SurvivalTimeToEventSupport2 task (line 27, used at line 42) and depends on its output keys (features, duration, event, patient_id). This is a link to another concrete task component that the PR description does not name. Either confirm the sharing in the PR description and explain why the existing task is used, or keep the example self-contained by building its own cohort from the CSV. Both options are acceptable.
|
|
||
| return { | ||
| "logit": log_risk, | ||
| "y_prob": mixture_probs, |
There was a problem hiding this comment.
[low] y_prob holds latent subgroup membership, not survival probability
forward() returns the mixture membership probabilities under y_prob. In PyHealth, y_prob is the model's prediction, so generic code (Trainer metrics, interpretability) will read membership probabilities as survival outputs. The docs state this, so it is non-blocking. Consider a separate key name or a note in the class docstring. The model also returns no loss key, so it cannot use the standard Trainer; this too is documented.
There was a problem hiding this comment.
AI Review
suggestion: need change
decision: human review
Thank you for contributing Deep Cox Mixtures. It adds a mixture-of-Cox survival model with Breslow baselines, a dedicated EM training method, tests, documentation, and a SUPPORT2 reproduction and ablation. The model is self-contained and the tests are thorough. Coverage meets the bar: deep_cox_mixtures.py is at 88.5% and the whole repository is at 86.8%.
To get this merged:
- examples/support2_survival_deep_cox_mixtures.py builds on the existing Support2Dataset and SurvivalTimeToEventSupport2 task. Your PR description doesn't mention this. Please either add a sentence to the description confirming the reuse is intended and saying why (for example, to reproduce the paper's experiments on PyHealth's own SUPPORT2 pipeline), or make the example self-contained.
Optional suggestions:
- Section 6.4 of deep_cox_mixtures_results.md gives White ECE values (0.0241, 0.0266, 0.0266) that appear in none of the tables above it. Consider adding a White-population table or noting where those numbers come from.
- The examples need scikit-survival and matplotlib. You already say to install them in the reproduction instructions. Adding the same note at the top of the example docstrings would help.
- Consider adding tests for the other input checks in fit_em, such as non-positive durations, non-finite features and a mismatched feature count. Only invalid events and invalid component counts are tested now.
- The docstring Examples blocks in cox_partial_loss, DeepCoxMixtures and BreslowBaseline are indented oddly, so they may render badly in Sphinx. BreslowBaseline also has a stray whitespace line after its docstring.
- Your description says the Sphinx build succeeded "with warnings". Check whether any come from these docstrings.
Reviewed commit 7fbe77d
|
Why this PR has To help the maintainers decide, please comment here with what your PR does that the others don't, such as fidelity to the paper, results or test coverage. Whichever PR isn't picked can still contribute its unique parts on top of the chosen one. The decision is tracked in #1668. This branch also conflicts with master (registration lines only). The AI review's 'To get this merged' points are still open. |
|
We compared the four Deep Cox Mixtures PRs and picked #1641 to merge first. This PR had four main gaps:
After #1641 merges, please contribute:
Drop: the duplicate model, the synthetic matplotlib example, and most of the results file. |
Summary
This PR introduces Deep Cox Mixtures (DCM), a deep learning survival regression model that captures heterogeneous patient populations through a mixture of component-specific Cox proportional hazards models.
The implementation is based on:
Nagpal et al. (2021), Deep Cox Mixtures for Survival Regression.
https://proceedings.mlr.press/v149/nagpal21a.html
Implementation
Shared neural network feature encoder.
Probabilistic mixture gating network.
Component-specific log hazard ratios.
Cox partial likelihood with Breslow handling of tied event times.
Breslow baseline cumulative hazard estimation.
Shape-preserving cubic interpolation (PCHIP).
Approximate expectation-maximization training.
Patient-specific survival probability prediction.
Checkpoint persistence for neural parameters and baseline hazard functions.
Files Added or Modified
File | Description -- | -- pyhealth/models/deep_cox_mixtures.py | Core model implementation pyhealth/models/__init__.py | Model registration tests/core/test_deep_cox_mixtures.py | Unit tests examples/deep_cox_mixtures_example.py | Runnable synthetic example examples/support2_survival_deep_cox_mixtures.py | SUPPORT2 experiments examples/deep_cox_mixtures_uncertainty.py | Fold-based uncertainty analysis examples/deep_cox_mixtures_results.md | Experimental results and ablation study docs/api/models/pyhealth.models.deep_cox_mixtures.rst | API documentation docs/api/models.rst | Documentation indexThe three-component configuration achieved the strongest observed balance between discrimination and probabilistic accuracy. Increasing the number of mixture components beyond three did not consistently improve performance.
Detailed experimental results, demographic subgroup analysis, uncertainty estimates and reproduction instructions are provided in
examples/deep_cox_mixtures_results.md.Testing
All 20 DCM unit tests passed locally.
Tests cover mathematical correctness, tied event times, censoring, mixture probabilities, gradient computation, EM training, survival prediction, input validation and checkpoint persistence.
The synthetic demonstration can be executed without downloading SUPPORT2:
Documentation and Formatting
API documentation added and registered.
Sphinx HTML documentation built successfully with warnings.
Python files formatted using Black and isort.
Limitations
DCM uses its dedicated
fit_em()training method rather than the standard PyHealth Trainer.PCHIP interpolation differs from the original paper's spline smoothing procedure.
The experimental calibration estimator differs from the published estimator.
Uncertainty estimates are descriptive fold-based standard errors rather than patient-level bootstrap standard errors.
The experiments reproduce several qualitative performance trends but do not establish exact numerical reproduction.
Contribution Checklist
Core model implementation
Model registration
Unit tests
Runnable synthetic example
Experimental evaluation
Ablation study
API documentation
Code formatting
Local regression tests
Course Information
Course: Georgia Tech CSE6250 — Big Data for Healthcare
Project: Deep Cox Mixtures for Survival Regression
Georgia Tech username: copara8 and mcrosby8
Georgia Tech email: copara8@gatech.edu & mcrosby8@gatech.edu
GitHub username: doziej84
Contribution type: Model implementation