Skip to content
Open
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
4 changes: 4 additions & 0 deletions docs/api/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ routes each feature type automatically.
* - :doc:`models/pyhealth.models.RNN`
- Your features are sequences of medical codes (diagnoses, procedures, drugs) across visits
- One RNN per feature, hidden states concatenated; ``rnn_type`` can be ``"GRU"`` (default) or ``"LSTM"``
* - :doc:`models/pyhealth.models.ShiftLSTM`
- Your time-series task may exhibit phase-specific or time-varying relationships
- Uses segment-specific LSTM parameters; ``num_segments=1`` acts as the shared-parameter baseline
* - :doc:`models/pyhealth.models.Transformer`
- You have longer code histories and want attention to capture long-range dependencies
- Self-attention across the sequence; tends to work well when visit order matters
Expand Down Expand Up @@ -174,6 +177,7 @@ API Reference
models/pyhealth.models.MLP
models/pyhealth.models.CNN
models/pyhealth.models.RNN
models/pyhealth.models.ShiftLSTM
models/pyhealth.models.GNN
models/pyhealth.models.Transformer
models/pyhealth.models.TransformersModel
Expand Down
26 changes: 26 additions & 0 deletions docs/api/models/pyhealth.models.ShiftLSTM.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pyhealth.models.ShiftLSTM
========================================


The segment-wise recurrent layer and the complete ShiftLSTM model.

``ShiftLSTM`` relaxes parameter sharing over time by dividing the sequence
into ``K`` temporal segments. Each segment uses its own ``LSTMCell`` while the
hidden and cell states continue flowing through the full sequence. When
``num_segments=1``, the model reduces to the shared-parameter baseline.

This implementation is inspired by:

Oh, J., Wang, J., Wiens, J. (2019).
"Relaxed Parameter Sharing: Effectively Modeling Time-Varying Relationships
in Clinical Time-Series."

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

.. autoclass:: pyhealth.models.ShiftLSTM
:members:
:undoc-members:
:show-inheritance:
Loading