feat: Add ShiftLSTM model contribution with tests, docs, and examples#1032
Open
mamahhh wants to merge 3 commits intosunlabuiuc:masterfrom
Open
feat: Add ShiftLSTM model contribution with tests, docs, and examples#1032mamahhh wants to merge 3 commits intosunlabuiuc:masterfrom
mamahhh wants to merge 3 commits intosunlabuiuc:masterfrom
Conversation
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.
PR Draft: ShiftLSTM Reproduction in PyHealth
Contributor Information
Sijia Masijiam2 / sijiam2@illinois.eduModel contributionOriginal Paper
High-Level Description
This pull request adds
ShiftLSTMto PyHealth as a new model contribution.ShiftLSTMrelaxes recurrent parameter sharing over time by dividing asequence into
Ktemporal segments. Each segment uses its ownLSTMCell,while hidden state and cell state still propagate through the full sequence.
In this implementation:
num_segments = 1acts as the shared-parameter baselinenum_segments > 1relaxes parameter sharing over timeThis PR also adds:
Why This PR Fits the Paper Reproduction
The original paper studies time-varying input-output relationships in
sequential prediction. This PR directly implements one of the paper's core
methods,
shiftLSTM, and evaluates it with synthetic ablation experimentsaligned with the paper's synthetic setup.
File Guide
Core implementation
pyhealth/models/shift_lstm.pyShiftLSTMLayerandShiftLSTMpyhealth/models/__init__.pyShiftLSTMandShiftLSTMLayerTests
tests/core/test_shift_lstm.pyExample / Ablation
examples/synthetic/shift_lstm_synthetic_data.pyexamples/synthetic_sequence_classification_shift_lstm.pyKanddeltaDocumentation
docs/api/models/pyhealth.models.ShiftLSTM.rstdocs/api/models.rstShiftLSTMto the models indexTesting
Run the model tests with:
These tests use only synthetic or pseudo data and complete quickly.
Example Usage
Run the ablation/example script with:
Ablation Summary
We ran three kinds of synthetic experiments:
K = 1, 2, 4Ksweep withK = 1, 2, 4, 8delta = 0.0, 0.1, 0.2Main results at
delta = 0.2, averaged over 3 seeds:These results support the paper's main qualitative claim that relaxing
parameter sharing can help when relationships vary over time.
Notes
shiftLSTM, notmixLSTM