# End-to-end example

A worked demo of the Standard Model: load MIMIC-IV demo data in MEDS format, extract patient-representative embeddings with `smb-v1-1.7b`, and train linear probes on four clinical tasks. Runtime from prompt through model download, inference, and classifier train/test is about 5 minutes.

Pipeline:

1. **Input** — MEDS events stream + per-patient labels parquet
2. **Encode** — serialize events → `smb-v1-1.7b` → last-token hidden state
3. **Probe** — train 4 task heads on an 80/20 split
4. **Report** — metrics per task

## The data: two parquet files

This example uses the [MIMIC-IV Clinical Database Demo](https://physionet.org/content/mimic-iv-demo-meds/) — a reduced, publicly available subset for teaching and development, not the full MIMIC-IV database — in MEDS format.

- **Events data** — a long table of timestamped clinical events (diagnoses, medications, labs). `prep_mimic_demo_data.py` reshapes the source parquet to the columns this demo needs. The final demo parquet holds **~916K rows for 100 subjects**.
- **Labels data** — per-patient labels for the four predictive tasks. Predictive task labels are artificially generated.

## Running the demo

With an AI agent: paste the prompt from the page into your coding assistant of choice (Claude Code, Codex, Gemini).

If you already ran the [quickstart install](https://standardmodel.bio/install.html):

```
cd quickstart
uv run python demo.py
```

Expected output covers four stages: loading MIMIC-IV demo data (916,166 events, 100 subjects), loading the Standard Model (smb-v1-1.7b), generating embeddings for 100 patients (causal inference, last-token pooling), and training the linear probes.

## The four tasks

| Task | Type | Target | Metric |
|---|---|---|---|
| Readmission risk | Binary classification | 30-day readmission | AUROC |
| Phenotype stage | Multiclass | Disease stage | Accuracy |
| Overall survival | Regression | Continuous months until death | MAE |
| Cox proportional hazards | Survival analysis | Time-to-event with censoring | C-index |

## Where to go next

- [Use the model on your own data](https://standardmodel.bio/your-data.html) — MEDS schema, serialization, and swapping in your own pipeline
- [More about the Standard Model](https://standardmodel.bio/model-hub.html) — JEPA architecture, state prediction, fusion layers, training paradigms, memory optimization
- Questions: info@standardmodel.bio

## Attribution

Events are from the MIMIC-IV Clinical Database Demo converted to MEDS.

van de Water et al. (2025). [MIMIC-IV demo data in the Medical Event Data Standard (MEDS) (version 0.0.1)](https://doi.org/10.13026/t2y8-ea41). PhysioNet. RRID:SCR_007345.

Licensed under the [Open Database License (ODbL)](https://opendatacommons.org/licenses/odbl/1.0/). Redistribution must be under ODbL (share-alike); do not apply technical measures that restrict reuse. Predictive task labels are artificially generated.

© 2026 Standard Model Biomedicine · San Francisco, CA
