Repository navigation
Conversation
Test CoverageTotal: 74.75% (21241 / 28416 lines)
|
… fields
SequenceEmbeddingModel embeds the packed records of sequence_v2 fields:
per level, one nn.Embedding per token namespace (<pad> embeds to zeros)
and a projection of the values, concatenated. Levels are kept apart with
their offsets and times, or flattened per field into one sequence of
level-0 records carrying their ancestors' embeddings. Spatial value axes
can be kept (token embeddings broadcast over them), masks ignored or
concatenated, and token namespaces initialized from pretrained vectors.
MultimodalRNN2 encodes each sequence_v2 field into one summary per
sample and uses TensorProcessor fields as statics (directly or
projected); other processors are rejected. Per field, the hierarchy is
"flat" (one RNN over the flattened records), "bottom_up" (level by
level, sets pooled, RNNs per group) or "interleaved" (each level's state
passed down to its children as context, step by step). Empty groups get
zero summaries, time gaps can be added as a feature, and per-step labels
use each field's top-level state after its last record before the step.
Every option takes one value or a {field: value} dict.
- TimeseriesBinaryLabelProcessor / TimeseriesRegressionLabelProcessor are
restricted SequenceProcessorV2s: one series level of scalar labels,
{"time", "values"} with strictly increasing times and no NaN. Batches
are packed (values, time, batch offsets); there is no grid or mask.
- Per-step prediction is V2 only: MultimodalRNN2 predicts once per label
record, from each field's state at or before the label's time; the
timeseries losses average over label records, and Trainer.inference
splits them per sample. RNN and MultimodalRNN reject per-step labels.
- BaseModel resolves a processor's mode from its most specific registered
class, so the labels do not resolve to "sequence_v2".
- The YAIB tasks give "dynamic" as a sequence_v2 series in hours since ICU
admission, preprocessed as before (forward fill, the training mean
before the first value, z-score, missing-value mask), and the per-hour
labels on the same hours.
Update the SequenceProcessorV2 RNN model class from MultimodalRNN2 to Unified_RNN and update model exports and test suites accordingly.
Add an end-to-end example script (examples/yaib_mimic4_multimodal_rnn2.py) to train and evaluate Unified_RNN across the five MIMIC-IV YAIB tasks (mortality, kidney function, length of stay, AKI, and sepsis), with preflight validation and metric logging.
This branch has not been deployed
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.
This is the second PR in the stack toward unified sequential features, building on #1343. It adds SequenceEmbeddingModel and three prediction baselines for packed SequenceProcessorV2 records: Unified_RNN, Unified_MLP, and Unified_LogisticRegression. It also migrates YAIB tasks and per-step labels to V2 and provides MIMIC-IV YAIB training examples.
Sequence embeddings and models
Per-step labels and YAIB integration
Validation
Following PRs
Update Transformer, CNN/TCN, and EHRMamba to consume sequence_v2 fields, and add a packed_to_padded adapter for dense sequence layers.