Back to the documentation index. Added November 2026. Group-level results only.
Every setting below, from the number of epochs to the order in which parameters are learned, is tuned to the dataset, the way a learning rate or a penalty is. This page records how we tune them on UK Biobank and how to tune them on new data. It has three parts. The first applies directly to the model documented on this site. The second and third describe the successor model, which is documented on the Mendelnoulli site.
The manuscript recipe trains each batch for 300 epochs, inside the held-out plateau shown below. That is an early stop by design. It is not convergence of the training loss, and the training loss should not be used to decide when to stop.
The non-centered model writes each person's loading as a genetic part plus a person-specific part,
λ = reference + G·γ + δ. The likelihood sees only λ. The person-specific term δ has about ten million
free entries per 10,000-person batch and a weak prior, so it keeps fitting the training batch for as long as training runs. The training
loss therefore falls at 300 epochs, at 2,000, and beyond. That says δ is fitting the batch more closely. It says nothing about
whether γ has improved or whether the model predicts better.
What we measured: the backbone trained on one batch of 10,000 people and frozen at each epoch, the person terms refitted on a disjoint batch, and scores taken on the years after enrolment.
| epochs | training loss | held-out NLL | observed / expected | 10-year AUC (median, 28 groups) |
|---|---|---|---|---|
| 50 | 61.6 | .00942 | 2.83 | .659 |
| 150 | 54.5 | .00872 | 1.43 | .676 |
| 300 | 48.8 | .00869 | 1.11 | .679 |
| 600 | 40.6 | .00878 | 0.80 | .672 |
| 2000 | 36.0 | .00979 | 0.43 | .660 |
γ is
known, the non-centered fit recovers it at a correlation of about 0.95 from 100 to 600 epochs and about 0.5 by 2,000 and later. The centered fit
stays near 0.8 throughout. The value of about 0.95 quoted on this site is at the early stop. Training to 2,000 or more epochs will not reproduce it.γ as the mean over batches, with the epoch stated. Its size changes along the training path, and one batch is noisy.The table above was measured on the successor model described next. The model on this site shares the parameterisation and the same recovery simulation, and its learning-rate, schedule and prior-weight sweeps selected the same 300-epoch constant-rate recipe on held-out AUC. The full held-out curve was measured on the successor model. Details: training length and stability.
In the original model a person's signature weights have to carry two things at once: signature composition, meaning which diseases they have, and rate, meaning how much disease they have. These are different things, and mixing them distorts both the signatures and the genetic effects. The three additions below separate them. Together we call them the "triplet." All models are wrong, but some are less wrong, as I imagine will be the case as noulli evolves!
Next to the K disease signatures, each person also gets a "healthy" component. It's anchored to the population's disease-free curve: the log-odds of staying free of disease at each age. We temper that curve toward the average of the disease signatures (factor 0.6) and shift it to a mean of 1.5. The result is a healthy reference that is strongest when people are young, fades with age, and stays above the most heavily loaded disease signature through mid-life. Someone who stays healthy can load on this component rather than being pushed into whichever disease signature fits least badly.
It also fixes an identifiability problem. Signature weights are a softmax, so adding the same shift to every component changes nothing. We estimate the genetic level of the health component once and then hold it fixed, which makes the genetic effects on the other components absolute rather than relative. The health component also has no genetic age trend, so the age interactions are measured against it.
Because θi is a composition (that inherently sums to 1), two people with the same mix of diagnoses get the same θi even if one has twice as many diagnoses. So each person gets one frailty, fi, applied after the sum over components:
1 − π̃ = (1 − π)exp(fi)
Here exp(fi) multiplies that person's cumulative hazard for every disease at every age. It changes their overall disease rate but not their signature composition. The values are centered, and their prior has SD 0.5.
The frailty is what makes the health component work. A single healthy curve can't fit both sexes, whose overall rates differ, and without frailty it ends up calibrated for women. In our ablation, men's weight on the health component went from 0.14 to 0.56 once frailty was added. It's pretty cool because if you add more data suggesting someone is more or less healthy, their health signature can slightly rise to account for increasing frailty, since health is a short-term marker and frailty captures a larger diagnostic burden.
We regress the 36 polygenic scores on the first 10 genetic PCs, using one least-squares fit across the whole cohort. We keep the residuals, drop the PCs themselves, and add sex (P = 37). If the PCs are left in, ancestry can move the healthy reference and get mistaken for disease structure.
| where | what |
|---|---|
| Site | Each main figure has a page showing its scripts. The "Why the triplet" page has the ablation figure, which shows what each piece changes across ancestry groups. |
| Code (repository private at present) | model: src/clust_huge_amp_vectorized_reparam_slope_3way.py; training: src/train_slope_3way.py; held-out prediction: src/triplet_loo_calibration.py. The header of each file explains why each piece is needed. |
| Preprint | The Methods sections "Health component" and "Frailty" have the full definitions. |
The data paths in the code are hard-coded to the authors' machine, so it is best read as a reference for now.
With a health component, a person with no diagnoses can be explained in two ways: by the health component, or by a large sex coefficient that places men in one quiet signature and women in another. Both fit the training data about equally. The health component fills late in training and the genetic coefficients move early, so small differences decide which explanation is reached.
The sex coefficient is held at its starting value for the first 150 epochs, so the health component fills first, and is then released. Everything else, including the polygenic coefficients, trains from the first epoch. The model and its likelihood are unchanged; only the order in which parameters may move changes. It is stopped at about 375 epochs, where calibration on held-out people is right (0.99 on each of three random starts).
| original recipe | staged | |
|---|---|---|
| three random starts on one batch | one in the parked state | all three agree, in training and held out |
| men's health share across six batches chosen to span the spread | 0.41 to 0.86 | 0.69 to 0.71 |
| 10-year AUC within sex, median over 221 diseases | 0.630 | 0.630 |
| observed / expected by epoch, one batch scored on another | 1.12 at 300, 1.05 at 350, 0.99 at 400 | 1.16 at 300, 1.03 at 350, 0.99 at 375, 0.96 at 400 |
| three random starts at the stop: observed / expected on held-out people | 1.11, 1.10, 1.30 at 300 | 0.99, 0.99, 0.99 at 375 |
| pooled backbone of four fits, scored on held-out people: observed / expected | 1.13 | 1.04 |
| pooled backbone of four fits: 10-year AUC within sex, median | 0.632 | 0.631 |
| pooled backbone of four fits: 1-year AUC, the manuscript's 28 groups | 0.928 | 0.950 |
| pooled backbone of four fits: 10-year AUC, the manuscript's 28 groups | 0.684 | 0.679 |
A second way to stage it is to average γ over the first-stage batch fits and refit with it held fixed. Two random starts then give the
same fit, and held-out prediction matches the original recipe. It takes on the quality of the fits that are averaged, so those are checked first.
Three random starts on one batch; the stop rests on one training batch scored on one group of held-out people; six of 40 batches were refitted. The manuscript's figures use the 300-epoch recipe without the staging; none of its 40 batch fits is fully in the parked state and two are partway.
γ depends on the stopping epoch.How to apply it, with the command and the checks to run on a fit: training notes. Evidence, table by table: training length and stability.