Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/metrics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ reference includes the ECE definition and formula used by these helpers.

metrics/pyhealth.metrics.multiclass
metrics/pyhealth.metrics.multilabel
metrics/pyhealth.metrics.ranking
metrics/pyhealth.metrics.binary
metrics/pyhealth.metrics.calibration
metrics/pyhealth.metrics.bootstrap
Expand Down
3 changes: 3 additions & 0 deletions docs/api/metrics/pyhealth.metrics.multilabel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

.. autofunction:: multilabel_metrics_fn

The ``precision@K``, ``recall@K`` and ``ndcg@K`` metrics are computed by
:func:`pyhealth.metrics.ranking.multilabel_ranking_at_k`.


Metric order
------------
Expand Down
8 changes: 8 additions & 0 deletions docs/api/metrics/pyhealth.metrics.ranking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pyhealth.metrics.ranking
===================================

.. currentmodule:: pyhealth.metrics.ranking

.. autofunction:: multilabel_ranking_at_k

.. autofunction:: ranking_metrics_fn
1 change: 1 addition & 0 deletions docs/api/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -279,5 +279,6 @@ API Reference
models/pyhealth.models.ProtoECGNet
models/pyhealth.models.HeartLang
models/pyhealth.models.APN
models/pyhealth.models.TRACE
models/pyhealth.models.MIRA

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

TRACE: a time-aware Transformer for intra-visit clinical event nowcasting.
A visit trajectory of event codes and times, followed by a mask token, is
encoded with a timestamp embedding (decay and periodic parts) and Transformer
layers whose attention is denoised by a learnable smoothed mask; the mask
token's final state predicts the laboratory events of the next blood draw
(`Liang et al., WWW 2025 Companion <https://arxiv.org/abs/2503.23072>`_).

Pairs with :class:`~pyhealth.tasks.LabNowcastingMIMIC4` and
:class:`~pyhealth.tasks.LabNowcastingMIMIC3`. See
``examples/trace_mimic4_lab_nowcasting.ipynb`` for a run on the MIMIC-IV
demo and on full MIMIC-IV.

.. autoclass:: pyhealth.models.TRACE
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: pyhealth.models.TRACETimeEmbedding
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: pyhealth.models.TRACEAttention
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: pyhealth.models.TRACELayer
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/api/tasks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,6 @@ Available Tasks
Cancer Survival Prediction (TCGA) <tasks/pyhealth.tasks.CancerSurvivalPrediction>
In-Hospital Survival (MIMIC-IV) <tasks/pyhealth.tasks.InHospitalSurvivalMIMIC4>
Rare-Condition ICU Mortality (KnowRare, MIMIC-IV) <tasks/pyhealth.tasks.KnowRareICUMortalityMIMIC4>
Lab Nowcasting (MIMIC-III/IV) <tasks/pyhealth.tasks.LabNowcasting>
ICU Acuity and Therapies (MIMIC-IV) <tasks/pyhealth.tasks.ICUAcuityMIMIC4>
Cancer Mutation Burden (TCGA) <tasks/pyhealth.tasks.CancerMutationBurden>
28 changes: 28 additions & 0 deletions docs/api/tasks/pyhealth.tasks.LabNowcasting.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
pyhealth.tasks.LabNowcasting
============================

Intra-visit laboratory event nowcasting, the task of TRACE (Liang et al.,
WWW 2025 Companion): from the events so far in a hospital admission
(laboratory results with their flag, medications), predict which laboratory
events, test and flag, the next blood draw will contain. Laboratory results
are flagged high/low/normal from the reference range on MIMIC-IV and
abnormal/normal on MIMIC-III. Pairs with :class:`~pyhealth.models.TRACE`;
score it with ``multilabel_metrics_fn`` (``pr_auc_micro``, ``f1_micro``,
``precision@5``, ``ndcg@5``).

.. autoclass:: pyhealth.tasks.LabNowcastingMIMIC4
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: pyhealth.tasks.LabNowcastingMIMIC3
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: pyhealth.tasks.LabNowcasting
:members:
:undoc-members:
:show-inheritance:

.. autofunction:: pyhealth.tasks.lab_flag
Loading
Loading