Downloads · 30 days
0
hongtaohao/tempo
tempo is a machine learning model from hongtaohao. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This repository contains codes, data and models to reproduce the results reported in the submission of TEMPO: Transformers for Temporal Disease Progression from Cross-Sectional Data.
Downloads · 30 days
0
Access
Public
Updated Apr 16, 2026
Repo size
563 MB
Likes
0
Public
Click a slice to open those files.
.pth551 MB · 97%
From the Hugging Face model README
This repository contains codes, data and models to reproduce the results reported in the submission of TEMPO: Transformers for Temporal Disease Progression from Cross-Sectional Data.
Additionally,
https://github.com/hongtaoh/TEMPO_lowdim contains the reproducible codes for the low dimensional experiments for the benchmarking algorithms.https://github.com/hongtaoh/TEMPO_highdim contains the reproducible codes for the high dimensional experiments for the benchmarking algorithms.First, git clone this repository. Then create a virtual environment and install dependences:
uv venv --python python3.11
source .venv/bin/activate
uv pip install -r requirements.txt
The scripts are optimized for GPU execution. While CPU execution is supported, expect significantly longer runtimes.
From the root directory, run these three commands in order:
bash gen.sh # Generate all synthetic data (lowdim + highdim, train + test)
bash run_all.sh # Train all models (lowdim then highdim)
bash postprocess.sh # Run inference, flatten results, and generate plots
Before training, set the gpus: block in config.yaml to match your available GPUs:
gpus:
0: [exp1, exp2, exp3]
1: [exp4, exp5, exp6, exp7, exp8, exp9]
That's it. No manual commenting/uncommenting of config files required.
bash gen.sh
This generates all four data directories (train, test, train_highdim, test_highdim).
Already-existing directories are skipped automatically.
To regenerate from scratch, delete the directories first:
rm -rf train test train_highdim test_highdim
bash gen.sh
To generate only one dimension:
python3 gen.py --mode lowdim
python3 gen.py --mode highdim
Additional parameters (number of datasets, participants, experiments, etc.) can be modified in config.yaml.
Set the gpus: block in config.yaml to assign experiments to GPUs, then run:
bash run_all.sh
This trains lowdim models first (saving to models/), waits for completion, then trains highdim models (saving to models_highdim/). Training logs are saved to the logs/ folder. If a models directory already exists and is non-empty, that step is skipped automatically.
If running on a remote server or want training to survive terminal close, use:
mkdir -p logs && nohup bash run_all.sh > logs/run_all.log 2>&1 &
To retrain from scratch:
rm -rf models models_highdim
bash run_all.sh
To train only one dimension:
bash run_parallel.sh --train_data_dir ./train --models_dir ./models
bash run_parallel.sh --train_data_dir ./train_highdim --models_dir ./models_highdim
To stop running jobs:
bash kill.sh
bash postprocess.sh
This runs three steps automatically:
Inference — evaluates trained models on all test experiments, saving results to:
results/cross_experiment_results_12bio.jsonresults/cross_experiment_results_100bio.jsonFlatten results — extracts diagonal (same-experiment) results into:
results/12bio_tempo.csvresults/100bio_tempo.csvPlots — merges TEMPO results with benchmark algorithm results and generates figures in plots/12bio/ and plots/100bio/.
Benchmark algorithm results are available in the benchmark_algo_results/ folder.
You'll need to request access to the ADNI data through https://adni.loni.usc.edu/data-samples/adni-data/. Download the ADNIMERGE.csv. Put it in the root directory of this repository. Then
python process_adni.py --raw ADNIMERGE.csv
You will see adni.csv and also id_dx.json. Then, run
python3 run_adni.py
Results will be saved to the adni_results folder.