Test In Colab

Data Tutorial 06: MIMIC Use Case

This tutorial shows how to use TemporAI with the MIMIC Dataset.

⚠️ This feature is experimental and may not yet work as expected.

Prerequisites

We provide integration with the MIMIC-IV dataset via an adaptation of MIMIC-IV-Data-Pipeline.

  1. You need to first install `temporai-mivdp <https://github.com/vanderschaarlab/temporai-mivdp>`__, as per its instructions.

  2. Note that you will also need to have obtained PhysioNet access credentials by following the official procedure

  3. You will also need to download the dataset files locally (note that the files are large).

Use

Once this is done, you should be able to access preprocessed MIMIC-IV data as a TemporAI data source, e.g.:

from tempor import plugin_loader

# Get the DataSource class:
MimicIVOneOffPred = plugin_loader.get_class("prediction.one_off.mivdp", plugin_type="datasource")

# Initialize.
mimic_iv_oneoff_pred = MimicIVOneOffPred(
    target="mortality",
    # ...
)

… And run models on it as usual:

model = plugin_loader.get("prediction.one_off.classification.nn_classifier", n_iter=50)

mimic_iv_oneoff_pred_train, mimic_iv_oneoff_pred_test = mimic_iv_oneoff_pred.train_test_split(test_size=0.2)

model.fit(mimic_iv_oneoff_pred_train)
model.predict(mimic_iv_oneoff_pred_test)