← Back to Index

Proof of Concept / Reinforcement Learning

Optimal Detailing
Sequencer

Multi-Armed Bandit for Specialty Oncology HCP Engagement

A contextual multi-armed bandit engine that learns the optimal touchpoint sequence for each HCP segment in specialty oncology. Thompson sampling adaptively allocates field force effort — face-to-face details, peer-to-peer programs, medical education, digital follow-up, and samples — by learning from each interaction's Rx lift signal. Built entirely in-browser with no backend dependencies.

Thompson SamplingContextual BanditBeta-BinomialRegret MinimizationHCP SegmentationField Force Optimization

Disclaimer: This is a proof-of-concept using synthetic HCP engagement data. All conversion rates, touchpoint costs, and segment profiles are illustrative. This tool is NOT intended to guide actual field force deployment or HCP engagement strategy.

Running detailing simulation...

Technical Architecture

Thompson Sampling

Beta-Binomial conjugate model for each touchpoint arm per HCP segment. Each interaction samples from all arm posteriors and selects the highest draw — naturally balancing exploration (uncertain arms) with exploitation (proven arms). Seeded Mulberry32 PRNG ensures reproducibility.

Contextual Bandit

Separate posterior maintained per HCP segment (Tier 1/2/3), enabling the algorithm to learn that the same touchpoint performs differently across segments. Face-to-face details excel with champions, digital follow-up outperforms with skeptics.

Regret Analysis

Cumulative regret tracks the gap between Thompson sampling's choices and the hindsight-optimal arm. Sub-linear regret growth (O(√T log T)) confirms the algorithm learns efficiently — the per-round regret decreases over time as posteriors sharpen.

References

  • Thompson WR. On the likelihood that one unknown probability exceeds another. Biometrika. 1933;25(3-4):285-294.
  • Russo D, Van Roy B, Kazerouni A, Osband I, Wen Z. A tutorial on Thompson Sampling. Found Trends Mach Learn. 2020;11(1):1-96.
  • Lattimore T, Szepesvári C. Bandit Algorithms. Cambridge University Press; 2020.
  • Fischer MA, et al. Prescriber and patient determinants of generic drug use after patent expiration. JAMA. 2003;289(13):1649-1658.

Daniel Tran, PharmD

UC San Diego — Skaggs School of Pharmacy

Source code MIT. Content © 2026 Daniel Tran (CC BY-NC-SA 4.0).