Back to Reinforcement Learning Mind Map
中文·English
🎮 Reinforcement LearningID: thompson-sampling

Thompson Sampling

Thompson 采样
🎯Core Definition
Thompson Sampling (TS, probability matching) is a Bayesian exploration algorithm: maintain a posterior over each arm's mean reward; each round sample θaBeta(αa+wa,βa+la)\theta_a \sim \text{Beta}(\alpha_a + w_a, \beta_a + l_a) (Beta is the conjugate prior for Bernoulli rewards, waw_a/lal_a being arm aa's cumulative wins/losses) and play the arm with the largest sample. It plays each arm with probability equal to its posterior probability of being optimal — wider (more uncertain) posteriors get explored more, yielding a natural exploration-exploitation trade-off.
💡Use Cases
a default choice for online decisions in industry (ads, recsys, experimentation platforms) for its simplicity, sample efficiency, and empirical edge over UCB; interviews often ask for the Beta posterior update and conjugacy.
Key Problems Solved
UCB's confidence bound is a frequentist construction that underuses priors/reward structure; TS encodes uncertainty directly into selection probabilities via posterior sampling, achieves O(lnT)O(\ln T) regret with strong worst-case guarantees, is more robust to non-stationary rewards, and extends naturally to contextual features (Linear/Logistic TS).
🎯5 High-Frequency Exam Points
1
Derive the Beta posterior: prior Beta(α,β)\text{Beta}(\alpha, \beta) + Bernoulli observations → Beta(α+w,β+l)\text{Beta}(\alpha + w, \beta + l)?
2
Numerical: prior Beta(1,1)\text{Beta}(1,1); arm1 has 8 wins/2 losses, arm2 3 wins/7 losses — write both posteriors and argue which arm the next sample favors.
3
TS vs UCB regret: why does TS often perform better in practice?
4
How does TS degrade under non-stationary rewards, and what fixes exist?
5
The probability-matching property: play probability equals posterior probability of optimality — what does it imply for exploration?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Thompson Sampling"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardUCB1 (Upper Confidence Bound)Next CardContextual Bandit

🔗 More Reinforcement Learning Knowledge Cards

Actor-CriticBehavioral CloningCoT & Reasoning RLConservative Q-Learning