This documentation is organized into five main sections for reviewers:
Note: Installation instructions are not required for reviewers. A pre-configured environment will be provided for running the code.
Aladynoulli is a comprehensive Bayesian survival model that predicts disease trajectories by integrating genetic and clinical data. The model captures:
| Feature | Description |
|---|---|
| ✅ Scalable | Handles large-scale genetic and clinical datasets (400K+ individuals) |
| ✅ Flexible | Supports both discovery and prediction modes |
| ✅ Robust | Proper Bayesian uncertainty quantification |
| ✅ Fast | GPU-accelerated training and inference |
| ✅ Reproducible | Complete code and data processing pipelines |
The model predicts disease probability at time t as:
π_i,d,t = κ × Σ_k θ_i,k,t × φ_k,d,t
Where: - θ_i,k,t = softmax(λ_i,k,t) (signature proportions) - λ_i,k,t ~ GP(μ_k + G_i γ_k, K_λ) (temporal dynamics) - φ_k,d,t = sigmoid(μ_d+ψ_k,d, K_φ) (disease probabilities)
Comprehensive interactive analyses addressing reviewer questions and model validation.
| Analysis | Description | Link |
|---|---|---|
| Clinical Utility | Dynamic risk updating and clinical decision-making | R1_Clinical_Utility_Dynamic_Risk_Updating.html |
| AUC Comparisons | Performance vs. established clinical risk scores | R1_Q9_AUC_Comparisons.html |
| Age-Stratified | Performance across different age groups | R1_Q10_Age_Specific.html |
| Heritability | Genetic architecture and heritability estimates | R1_Q7_Heritability.html |
| GWAS Validation | Genome-wide association studies on signatures; identifies 10 novel loci for Signature 5 not found in individual trait GWAS | R1_Genetic_Validation_GWAS.html |
| Gene-Based RVAS | Rare variant association studies on signatures | R1_Genetic_Validation_Gene_Based_RVAS.html |
| Biological Plausibility | CHIP analysis and biological validation | R1_Biological_Plausibility_CHIP.html |
| LOO Validation | Leave-one-out cross-validation robustness | R1_Robustness_LOO_Validation.html |
| Selection Bias | Assessment of selection bias and participation | R1_Q1_Selection_Bias.html |
| Clinical Meaning | Analysis of Familial hypercholesterolemia patients | R1_Q3_Clinical_Meaning.html |
| ICD vs PheCode | Detailed comparison of coding systems | R1_Q3_ICD_vs_PheCode_Comparison.html |
| Competing Risks | Multi-disease patterns and competing risks | R1_Multi_Disease_Patterns_Competing_Risks.html |
| Analysis | Description | Link |
|---|---|---|
| Temporal Leakage | Assessment of temporal leakage and prediction accuracy | R2_Temporal_Leakage.html |
| Washout Comparisons | Multi-approach washout analysis (time horizon, floating prediction, fixed timepoint) | R2_Washout_Comparisons.html |
| Delphi Phecode Mapping | Principled Delphi comparison using Phecode-based ICD mapping | R2_Delphi_Phecode_Mapping.html |
| Model Validity | Model learning and validity assessment | R2_R3_Model_Validity_Learning.html |
| Analysis | Description | Link |
|---|---|---|
| Avoiding Reverse Causation | Reverse causation assessment with 0, 1, 3, 6-month washout periods | R3_AvoidingReverseCausation.html |
| Competing Risks | Detailed competing risks analysis | |
| Decreasing Hazards (Censoring Bias) | Analysis of decreasing hazards at older ages due to censoring bias | R3_Q4_Decreasing_Hazards_Censoring_Bias.html |
| Verify Corrected Data | Verification of corrected E matrix and prevalence calculations | |
| Linear vs Nonlinear | Linear vs nonlinear mixing approaches | R3_Linear_vs_NonLinear_Mixing.html |
| Population Stratification | Ancestry-stratified analysis | R3_Population_Stratification_Ancestry.html |
| Heterogeneity (Main Paper Method) | Main paper method with PRS validation (MI and breast cancer) | R3_Q8_Heterogeneity_MainPaper_Method.html |
| Heterogeneity (Continued) | Complete pathway analysis demonstrating biological heterogeneity | R3_Q8_Heterogeneity_Continued.html |
| Cross-Cohort Similarity | Cross-cohort signature correspondence analysis | R3_Cross_Cohort_Similarity.html |
Each main-text figure in the published manuscript has a dedicated Jupyter notebook. The rendered HTML versions are linked below; for full details on inputs, the Zenodo data archive, and the suggested reproduction workflow, see figure_reproduction.html.
| Figure | Topic | Rendered notebook |
|---|---|---|
| Figure 1 | Model overview (architecture schematic) | Figure1_Model_Overview.html |
| Figure 2 | Population-level signature patterns and temporal evolution | Figure2_Population_Level_Patterns.html |
| Figure 3 | Individual trajectories (A, B) + heterogeneity within disease subtypes (C) | Figure3_Individual_Trajectories.html + R3_Q8_Heterogeneity (Panel C line-filled plots) |
| Figure 4 | Genetic architecture: GWAS lead variants, RVAS hits, PRS heatmaps per disease subtype | Figure4_Genetic_Validation.html |
| Figure 5 | Multi-disease risk prediction vs PCE / PREVENT / GAIL / QRISK3 / Cox (centered model — as in shipped manuscript; reparam variant under Reparam Results) | Figure5_Predictive_Performance.html |
In the standard (“centered”) formulation, genetic effects (γ) enter only through the GP prior mean for λ. Because λ is a free parameter that directly enters the likelihood, the optimizer fits the data by adjusting λ and γ receives weaker gradient signal (only the W = 10⁻⁴ scaled GP prior). This can limit the accuracy of γ recovery — the individual-specific genetic effects that are essential for biological interpretation and out-of-sample prediction.
The non-centered formulation addresses this by decomposing λ into a genetic mean and a residual:
λ_i,k,t = μ_k + G_i γ_k + δ_i,k,t
where δ (not λ) carries the GP prior. Now γ flows through the forward pass into the NLL via the chain rule, receiving full gradient signal. Additionally, κ is fixed at 1 rather than learned, since κ and γ are not jointly identifiable (only κ·γ enters the likelihood).
| Analysis | Description | Link |
|---|---|---|
| Parameter Recovery Simulation | Synthetic data simulation (N=1000, D=50, K=5) comparing γ recovery: centered model (r ≈ 0.80) vs non-centered model (r ≈ 0.95). Uses the actual production model classes. | parameter_recovery_simulation.ipynb |
| Component | File | Description |
|---|---|---|
| Discovery Model (Reparam) | clust_huge_amp_vectorized_reparam.py | Non-centered model: λ = μ(γ) + δ, κ=1 fixed. γ and ψ receive NLL gradients directly. |
| Training Script | train_nokappa_v3.py | Constant LR=0.1, W=10⁻⁴, 300 epochs, no cosine scheduling, no gradient clipping |
The reparameterization above is a methodological refinement of the same v1 generative model — same disease topology, same survival likelihood, same parameter counts. Only γ estimation changes. The results below are from the reparam (nokappa-v3 LOO) pipeline applied to the published v1 cohort and metrics.
Headline: Across 28 major diseases, reparam improves AUC on 24–25 of 28 at every horizon (1-year baseline, 1-year median rolling, 10-year static/dynamic, 10-year rolling). Mean Δ AUC ranges from +0.023 (10-yr static) to +0.093 (1-yr baseline). The improvement reflects better γ identifiability, not a model change.
State-of-the-art comparison: Against the Delphi-2M transformer on the same disease–ICD-10 mappings, Aladynoulli reparam wins 27/28 phecode groups on rolling 1-year prediction, mean advantage +0.10 AUC.
| Comparison | Description | Source |
|---|---|---|
| 1-year (S6 columns) | Centered vs reparam: 1-yr Baseline (at enrollment, 400K) and 1-yr Median (rolling, 10K) AUC per disease, with Δ column. Reparam wins 25/28 on both. | tableS6_1yr_centered_vs_reparam.csv |
| 10-year (S6 + S8) | Centered vs reparam: 10-yr (best of static/dynamic, full 400K) and 10-yr rolling interpolation (10K, 10 offset-trained models). Reparam wins 24/28 (S6) and 25/28 (S8). | tableS6_S8_centered_vs_reparam.csv |
| Display notebook | Renders both tables with summary statistics and highlights the three diseases (MS, Prostate, Bladder Cancer) where reparam regresses due to documented signature-assignment instability for low-prevalence signatures. | centered_vs_reparam_comparison_tables.ipynb |
| Panel | Description | Source |
|---|---|---|
| Performance bars | Multi-disease, multi-method AUC bar chart with reparam Aladynoulli, Cox baseline, PCE/PREVENT/QRISK3/GAIL — sourced from feb18 reparam metrics. | performance_comparison_nokappa_mar4.pdf |
| ROC curves | ASCVD 1-yr ROCs at age-offsets 0–9 (reparam Aladynoulli) vs PCE/PREVENT 10-yr (enrollment). | roc_curves_ASCVD_reparam.pdf |
| Calibration | Predicted vs observed at-risk event rates across 5 orders of magnitude, full 400K cohort, reparam pi tensor. MSE = 2.5×10⁻⁵. | calibration_plots_full_400k_reparam.pdf |
| Washout (held-out LOO) | 1-month / 3-month / 6-month event-window washout, properly held-out (LOO pool from batches 1–39, delta refit on batch 0). Bar shape matches the published centered Figure 5C with higher absolute AUCs. | washout_performance_plot_reparam.pdf |
| Assembly notebook | End-to-end notebook that produces panels B (ROC), C (washout), and D (calibration) for the reparam Figure 5. | Figure5_REPARAM.ipynb |
| Comparison | Description | Source |
|---|---|---|
| Rolling 1-year | Aladynoulli reparam mean AUC 0.855 vs Delphi 0.754 (mean advantage +0.10); wins 68/82 (83%) of phecode-to-ICD-10 mapped comparisons. | delphi_vs_reparam_1yr_rolling.pdf |
| t0 (enrollment) | Aladynoulli reparam mean AUC 0.820 vs Delphi 0.754 (mean advantage +0.07); wins 53/82 (65%) of comparisons. | delphi_vs_reparam_t0_enrollment.pdf |
| Phecode↔ICD-10 mapping | Notebook that builds the principled disease-name → phenotype → ICD-10 mapping used for the Delphi comparison (using feb18 reparam predictions). | R2_Delphi_Phecode_Mapping_REPARAM.ipynb |
Predictions used in all of the above: the reparam LOO pi tensor at Dropbox/enrollment_predictions_nokappa_v3_loo_all40/pi_enroll_fixedphi_sex_FULL.pt (400K × 348 × 52). Per-batch checkpoints in Dropbox/censor_e_batchrun_vectorized_REPARAM_v3_nokappa/.
The reparam parameterization recovers larger γ magnitudes than the centered fit (centered γ is pulled toward zero by the joint MAP gradient; reparam isolates γ identifiability). The notebooks below quantify this gain and visualize it across three pools (original v1 centered, 400K LOO reparam, and centered-vs-reparam scatter).
| Analysis | Description | Source |
|---|---|---|
| Standalone reparam PRS-γ notebook | End-to-end re-fit and analysis of γ magnitudes under reparam: heatmaps, top PRS rankings per signature, FDR-adjusted significance. | reparam_prs_signature_associations.html |
| Three-pool γ comparison | Side-by-side centered (v1 published) vs reparam (400K LOO) vs original pool: scatter plots of γ effects, ranking changes, and FDR-significance overlap. | prs_signature_three_pool_comparison.html |
| γ association tables | Per-signature × per-PRS effect, SEM, z-score, p-value, FDR-adjusted q (BH). One CSV per pool. | 400K reparam · centered · original |
| γ magnitude scatter (figure) | Three-way scatter of γ magnitudes across pools — reparam recovers larger effects than centered, especially for top-ranked PRS-signature pairs. | prs_signature_threeway_scatter.pdf |
The Aladynoulli workflow consists of 5 main steps:
| Resource | Description | Link |
|---|---|---|
| Framework Overview | Discovery vs prediction framework - Essential reading | |
| Complete Workflow Guide | Step-by-step preprocessing → training → prediction | WORKFLOW.md |
| Preprocessing Guide | Preprocessing file creation guide | create_preprocessing_files.html |
| Component | File | Description |
|---|---|---|
| Discovery Model | clust_huge_amp_vectorized.py | Full model that learns phi and psi |
| Prediction Model | clust_huge_amp_fixedPhi_vectorized_fixed_gamma_fixed_kappa.py | Fixed-phi, fixed-gamma, fixed-kappa model for fast predictions |
Note: The prediction model uses fixed gamma (genetic effects) and kappa (calibration parameter) from pooled training batches. This ensures complete separation between training and testing data in each validation fold. Only lambda (individual-specific signature loadings) is learned during prediction.
| Script | Location | Purpose |
|---|---|---|
| Preprocessing | preprocessing_utils.py | Preprocessing utilities |
| Batch Training | run_aladyn_batch_vector_e_censor_nolor.py | Batch model training with corrected E (no LR regularization on gamma) |
| Master Checkpoint | create_master_checkpoints.py | Create pooled checkpoints (phi and psi) |
| Pool Gamma & Kappa | pool_kappa_and_gamma_from_nolr_batches.py | Pool gamma (genetic effects) and kappa (calibration) from training batch checkpoints |
| Prediction | run_aladyn_predict_with_master_vector_cenosrE_fixedgk.py | Run enrollment-based predictions using enrollment E matrix (E_enrollment_full.pt) with master checkpoint from corrected E training, using fixed gamma and kappa from pooled training batches (only lambda is learned per batch) |
For 10K individuals, 348 diseases, 52 timepoints: - Training Time: ~8-10 minutes per batch (converges after ~200 epochs) - Prediction Time: ~8 minutes per batch - Memory: ~8GB RAM (peak usage during training) - CPU: Multi-core recommended (4+ cores); PyTorch uses BLAS for parallel matrix operations
Scaling: - Full UK Biobank (400K individuals): Processed in 39 batches of ~10K each - Total training time: ~5-7 hours for all batches (can be parallelized) - Memory scales linearly: ~8GB per 10K batch
Why it’s fast: - Vectorized PyTorch operations (batched matrix decompositions) - BLAS Level 3 operations for efficient linear algebra - ~100-fold speedup compared to loop-based implementation
This repository contains no patient-identifying information. No individual-level identifiers (EIDs, MRNs, or other participant IDs) from UK Biobank, All of Us, or Mass General Brigham are included in any files or git history. All analyses use de-identified, aggregate-level results only.
Access to the underlying individual-level data from UK Biobank, All of Us, and Mass General Brigham requires separate approval from each institution’s data access committee and is available only with PI permission and institutional authorization.
If you use Aladynoulli in your research, please cite:
@article{aladynoulli2024,
title={Aladynoulli: A Bayesian Survival Model for Disease Trajectory Prediction},
author={Sur, P. and others},
journal={medRxiv},
year={2024},
doi={10.1101/2024.09.29.24314557}
}For questions or issues, please open an issue on GitHub.
Last Updated: February 2026