Estimation of the Warfarin Dose

Personalized dose selection with contextual bandits

Warfarin has a narrow therapeutic range, yet the appropriate dose can vary substantially with a patient’s demographics, medications, clinical history, and genetics. This project studies whether an online learner can use that context to choose among three weekly dose classes: low (below 21 mg), medium (21-49 mg), and high (above 49 mg).

Implemented Contextual bandits for learning online the dosages of warfarin, including LinUCB and LinTS. The project grew into a broader investigation of data preparation, exploration, and model structure. It is an experimental study, not a clinical prescribing tool.

I used 5,528 patient records from the International Warfarin Pharmacogenetics Consortium dataset. The preprocessing work handles mixed clinical, medication, demographic, and genetic variables; preserves informative missingness; compares K-nearest-neighbor and iterative Bayesian-ridge imputation; and excludes identifiers and post-treatment outcomes that could leak the target. I then compared fixed and published IWPC dosing references with LinUCB, ridge and hybrid ridge variants, a sparse Lasso-based UCB policy, and Linear Thompson Sampling.

The strongest learned configuration so far, a hybrid ridge policy with shared ordinal dose structure, reaches approximately 68.36% mean online accuracy over repeated patient permutations. This improves on the 61.18% fixed-dose baseline and the roughly 64% clinical formula, while remaining slightly below the pharmacogenetic reference near 69%.

For interpretability, I also isolated the best binary Lasso bandit. It is not the absolute top performer, but it is much easier to read: only 47, 54, and 72 of the 295 engineered features remain active for low, medium, and high dose arms.

The largest learned weights show the model’s sparse vocabulary for each arm: a medium-dose baseline, low-dose signals around age/genotype/body-size interactions, and high-dose signals involving genotype, medication, indication, and body-size structure.

Largest sparse Lasso coefficients by dose arm

For individual patients, I decompose the final saved policy’s selected-vs-runner-up margin. Green terms push toward the selected dose; red terms pull toward the runner-up. These are high-margin correct examples, chosen for explanation rather than as a clinical claim.

Patient-level Lasso decision explanations

The GitHub repository and its README contain the full preprocessing rationale, model implementations, experiment notebooks, diagnostics, and generated reports.