Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d6bb2b8
Created using Colab
lnguyen99 Nov 21, 2026
dff4aed
Add Deep Cox Mixtures model, option (b): EM in the example script
lnguyen99 Nov 21, 2026
9e61cf2
Created using Colab
lnguyen99 Nov 21, 2026
425e4bf
Merge add-deep-cox-mixtures: Deep Cox Mixtures model (option b)
lnguyen99 Nov 22, 2026
a271338
Revert fork master to upstream: remove DCM (b) test file (kept on add…
lnguyen99 Nov 22, 2026
4602e73
Revert fork master to upstream: remove DCM notebook (kept on add-deep…
lnguyen99 Nov 22, 2026
e0146ba
Revert fork master to upstream: remove DCM (b) model file (kept on ad…
lnguyen99 Nov 22, 2026
79a35fa
Created using Colab
lnguyen99 Nov 22, 2026
feeea7a
Merge pull request #3 from sunlabuiuc/master
lnguyen99 Nov 22, 2026
7dfaa5c
Implement Deep Cox Mixtures model (SUPPORT, script-level EM)
lnguyen99 Nov 22, 2026
ac5b39b
Created using Colab
lnguyen99 Nov 22, 2026
5b502be
Added required documentation
jzalwan2 Nov 28, 2026
27d386a
Clip to avoid NaN in DCM
kpullela05 Nov 29, 2026
0a5f4aa
Update DCM docs with 5-fold results
kpullela05 Nov 29, 2026
9b3ff84
5 fold results fixup
kpullela05 Nov 29, 2026
d62fde3
Add 5-fold results for both ablations
kpullela05 Nov 29, 2026
705bcd5
Merge branch 'master' of https://github.com/sunlabuiuc/PyHealth into …
jzalwan2 Nov 29, 2026
1a2424e
Merge branch 'sunlabuiuc:master' into implement-deep-cox-mixtures-model
jzalwan2 Nov 29, 2026
92dd675
deleted python notebook file in preparation for PR
jzalwan2 Nov 29, 2026
31c4770
Update comments on baseline refitting methods
kpullela05 Nov 29, 2026
1e25054
Merge branch 'sunlabuiuc:master' into implement-deep-cox-mixtures-model
jzalwan2 Nov 30, 2026
04eb9ea
Polished docstrings to better follow google-style
jzalwan2 Nov 30, 2026
37c103c
Fix Deep Cox Mixtures naming and line lengths
jzalwan2 Nov 30, 2026
07b8b99
Polished SUPPORT paper references and metric labels
jzalwan2 Nov 30, 2026
2438472
Merge branch 'sunlabuiuc:master' into implement-deep-cox-mixtures-model
jzalwan2 Nov 30, 2026
c7b378c
Merge branch 'sunlabuiuc:master' into implement-deep-cox-mixtures-model
jzalwan2 Nov 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -420,4 +420,5 @@ API Reference
models/pyhealth.models.QueryFocusedEHRModel
models/pyhealth.models.HiCu
models/pyhealth.models.WatchSleepNet
models/pyhealth.models.deep_cox_mixtures

63 changes: 63 additions & 0 deletions docs/api/models/pyhealth.models.deep_cox_mixtures.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
pyhealth.models.DeepCoxMixtures
===============================

Overview
--------

Deep Cox Mixtures estimates survival probabilities for right-censored
time-to-event data. A shared encoder predicts patient-specific mixture weights
and log hazard ratios. Each component has a baseline survival curve fitted
with a Breslow estimator and interpolated with a spline.

The model follows Nagpal et al., `Deep Cox Mixtures for Survival Regression
<https://proceedings.mlr.press/v149/nagpal21a.html>`_ (MLHC 2021).

Inputs and outputs
------------------

Use a PyHealth sample dataset with a dense numeric vector in the ``features``
input field and scalar tensors in the ``duration`` and ``event`` output fields.
Durations must be strictly positive. Set the event indicator to one for an
observed event and zero for right censoring. Set ``time_grid`` in the same
units as the durations.

Once baselines are fitted, ``forward`` returns the Q-loss in ``loss``,
duration and event labels in ``y_true``, and survival probabilities in
``y_prob`` with shape ``[batch, len(time_grid)]``. It also returns the
component log hazard ratios and log mixture weights. Use ``predict_survival``
to obtain survival probabilities at specified times from feature tensors.

Training uses the expectation-maximization loop in the example script. The
loop fits baseline survival curves using the training data. Keep the fitted
splines alongside model weights when saving a checkpoint, then restore them
with ``set_baselines`` before prediction.

Example and ablation
--------------------

From the root of this PyHealth checkout, install the survival dependencies
and run a short synthetic example::

python -m pip install -e '.[survival]'
python examples/support2_survival_time_to_event_deep_cox_mixtures.py \
--synthetic --epochs 2

To compare three mixture components with the single-Cox control on SUPPORT2,
run both configurations with the same seed and save separate results::

python examples/support2_survival_time_to_event_deep_cox_mixtures.py \
--folds 5 --k 3 --seed 42 --output support2_dcm_k3.json
python examples/support2_survival_time_to_event_deep_cox_mixtures.py \
--folds 5 --k 1 --seed 42 --output support2_dcm_k1.json

The script downloads SUPPORT2 as needed and fits feature scaling on the
training split. Its docstring records the 5-fold comparison. Time-dependent
concordance was 0.6296 for three components and 0.6125 for the single-Cox
control, and the mixture had lower ECE at all three event-time percentiles.

API
---

.. autoclass:: pyhealth.models.DeepCoxMixtures
:members:
:show-inheritance:
Loading
Loading