Skip to content

Implement Temporal Pointwise Convolutional (TPC) Model in Length of Stay prediction task#1119

Open
kchendv wants to merge 4 commits intosunlabuiuc:masterfrom
Vismayak:readyToMergeFinal
Open

Implement Temporal Pointwise Convolutional (TPC) Model in Length of Stay prediction task#1119
kchendv wants to merge 4 commits intosunlabuiuc:masterfrom
Vismayak:readyToMergeFinal

Conversation

@kchendv
Copy link
Copy Markdown

@kchendv kchendv commented Apr 23, 2026

Contributors

Type of Contribution

  • Model
  • Task
  • Processor

Link to Original Paper

Temporal Pointwise Convolutional Networks for Length of Stay Prediction in the Intensive Care Unit

High-level Description of Implementation

This pull request implements the paper "Temporal Pointwise Convolutional Networks for Length of Stay
Prediction in the Intensive Care Unit". Specifically, it implements

  1. Processors for timeseries and pointwise data preprocessing from the MIMIC-IV dataset
  • Time-series processor (TPCTimeseriesProcessor)
    • Hourly binning + forward-fill with decay
    • Data scaling based on 5th/95th percentiles
  • Static processor (TPCStaticProcessor)
    • One-hot encodes categorical static features
    • Data scaling based on 5th/95th percentiles
  • Regression-sequence label processor (RegressionSequenceProcessor)
    • Converts variable-length label sequences to tensors for padding/collation
  1. Implementation of the remaining LoS predication as a task
  • Generates hourly remaining ICU length-of-stay regression targets
  • Starts predictions at 5 hours, truncates sequences to 14 days
  • Uses ICU stays (icustays) and filters to adult patients
  • Produces a raw payload designed for TPC preprocessing (prefill window + irregular observations from chartevents/labevents)
  1. Implementation of the Temporal Pointwise Convolution (TPC) model
  • Stacked TPC blocks combining:
    • Per-feature causal temporal convolutions
    • Pointwise mixing across features per time step
    • Dense skip connections
  • Trains with masked MSLE over valid (non-padding) timesteps

Files to review

Examples

  • Training: examples/mimic4_remaining_los_tpc.py
  • Ablation: examples/mimic4_remaining_los_tpc_ablation.py

Core Implementation

  • pyhealth/models/tpc.py
  • pyhealth/processors/regression_sequence_processor.py
  • pyhealth/processors/tpc_static_processor.py
  • pyhealth/processors/tpc_timeseries_processor.py
  • pyhealth/tasks/remaining_length_of_stay_tpc_mimic4.py

Tests

  • tests/core/test_tpc.py

Documentation

  • docs/api/models.rst
  • docs/api/models/pyhealth.models.TPC.rst
  • docs/api/processors.rst
  • docs/api/processors/pyhealth.processors.RegressionSequenceProcessor.rst
  • docs/api/processors/pyhealth.processors.TPCStaticProcessor.rst
  • docs/api/processors/pyhealth.processors.TPCTimeseriesProcessor.rst
  • docs/api/tasks.rst
  • docs/api/tasks/pyhealth.tasks.RemainingLengthOfStayTPC_MIMIC4.rst

Misc / Config

  • pyhealth/datasets/configs/mimic4_ehr.yaml
  • pyhealth/__init__.py
  • pyhealth/models/__init__.py
  • pyhealth/processors/__init__.py
  • pyhealth/tasks/__init__.py

Vismayak and others added 4 commits April 6, 2026 18:04
Add a chartevents table mapping to pyhealth/datasets/configs/mimic4_ehr.yaml. Add test_notebook.ipynb to  aid manual testing (dev/demo usage) for TPC-LoS changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants