The reference baseline
An optional XGBoost reference model over point-in-time features that runs the full model-to-data loop.
flair-baseline is an optional reference model: XGBoost over
point-in-time features built only from events at or before each row's
feature_cutoff_dttm - min / max / mean / median of each numeric code (labs, vitals,
respiratory values), event counts for medications, ever-occurred flags for respiratory device
and mode, plus age, sex, and hours since the hospitalization's first event. The MIMIC-CLIF
reference models use an input vocabulary of 213 codes, which yields 448 inputs; XGBoost routes
missing numeric values natively, and absent medication and categorical events are encoded as
zero. It's the easiest way to see a report bundle without writing your own model - and it's
what ships frozen to sites for external validation. For each task it runs:
task.build() → Table 1 → CLIF→ELF event ETL → point-in-time featurizer → XGBoost (fit or
score) → report bundle.
Prepare, then score
Prepare the data once per site. prepare chains three stages:
build-cohorts (one cohort + Table 1 per task), build-data (one shared
CLIF→ELF event store over every task cohort) and featurize:
flair-baseline prepare \
--clif-config clif_config.json \
--out . \
[--task icu_daily_mortality] # default: all 4 tasksSplits come from the task cohorts: on MIMIC-CLIF a reproducible 75/25 assignment at the stay
level (a stitched hospitalization never spans train and test); at other sites the oldest 75%
for training and the newest 25% for testing unless explicit calendar cutoffs are given
(--train-end / --test-start).
Train at the source site (MIMIC-CLIF), producing the models that ship:
flair-baseline local-training \
--clif-config clif_config.json \
--out .Score at another site. Three model commands share the same local 25% holdout:
flair-baseline external-validation --models-dir mimic_baseline_models --clif-config site_clif_config.json --out .
flair-baseline transfer-learning --models-dir mimic_baseline_models --clif-config site_clif_config.json --out .
flair-baseline local-training --clif-config site_clif_config.json --out .external-validation scores the shipped model, frozen, on that site's
holdout; transfer-learning continues training the shipped model on the site's
training split; local-training fits a new model on it. Training commands run an
Optuna search by default (--hpo-trials 30; --no-hpo for fixed
parameters). The report mode per task comes from its META (continuous for the
mortality task and discharge to LTACs, episodic for extubation failure and ICU
readmission).
Output: three site-prefixed folders
Every run writes under --out into three folders prefixed with site
from the config. The PHI folder never leaves the site.
<site>_baseline_phi/_shared/MEDS/ shared event store ← stays local (PHI)
<site>_baseline_phi/<task>/ cohort.parquet, features.npz, preds_<kind>.parquet ← stays local (PHI)
<site>_baseline_non_phi_for_upload/<task>/ codes.parquet, table1.json, report/<kind>/*.json (+viz) ← upload this
<site>_baseline_models/<task>/<kind>/ model.json, vocab.json, params.json<kind> is local, external_validation or
transfer, one per model command. The MIMIC-CLIF models ship as
mimic_baseline_models/<task>/local/; the PHI and non-PHI folders carry the
running-site prefix.
flair_elf_config.yaml - the feature source of truth
This YAML (--elf-config on prepare / build-data) lists
the feature domains extracted into ELF, and is the single source of truth for
what the model may use (no separate exclude list):
VITAL, LAB, RESP, PA (GCS + RASS), MED_CON, MED_INTHOSP_DX (discharge diagnoses) is intentionally omitted - it is
timestamped at discharge and would leak into real-time predictions. To include or exclude a
domain, edit this file.