Back to Reinforcement Learning Mind Map
中文·English
🎮 Reinforcement LearningID: contextual-bandit

Contextual Bandit

上下文老虎机
🎯Core Definition
A Contextual Bandit extends MAB with an observable context feature xtRdx_t \in \mathbb{R}^d per round; the policy π(x)\pi(x) picks an action given features, maximizing the conditional expected reward E[rx,a]\mathbb{E}[r \mid x, a]. The representative algorithm LinUCB assumes a linear reward model rt,a=θaTxt,a+ϵr_{t,a} = \theta_a^T x_{t,a} + \epsilon, estimates per-arm parameters by ridge regression θ^a=(XaTXa+λI)1XaTya\hat{\theta}_a = (X_a^T X_a + \lambda I)^{-1} X_a^T y_a (XaX_a/yay_a: arm aa's historical feature matrix and reward vector, λI\lambda I the regularizer), builds the confidence bound pt,a=θ^aTxt,a+αxt,aT(XaTXa+λI)1xt,ap_{t,a} = \hat{\theta}_a^T x_{t,a} + \alpha \sqrt{x_{t,a}^T (X_a^T X_a + \lambda I)^{-1} x_{t,a}}, and plays the arm with the largest upper bound.
💡Use Cases
personalized recommendation (user + item features), ad bidding, dynamic pricing, feed ranking; interviews connect it to RecSys — context is feature engineering and the model is an online reward predictor.
Key Problems Solved
context-free MAB treats all users identically, with weak personalization and cold-start; contextual bandits share samples across contexts via features, speeding up cold-start and lifting reward, occupying a pragmatic middle ground between pure exploration and full RL/supervised learning — needing only live feedback, no offline datasets or simulators.
🎯5 High-Frequency Exam Points
1
Write LinUCB's ridge solution and confidence term; explain (XaTXa+λI)1(X_a^T X_a + \lambda I)^{-1} and the role of λI\lambda I?
2
Compute the cost of estimating θ^a\hat{\theta}_a in dd dimensions; why does the inverse covariance shrink as samples accumulate?
3
Fundamental differences among contextual bandits, full RL, and supervised (offline) ML?
4
How do you construct context features for recsys, and how do contextual bandits mitigate cold-start?
5
LinUCB vs online logistic regression/GBDT: what if linearity fails (kernel / neural contextual bandits)?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Contextual Bandit"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardThompson SamplingNext CardSlate / Combinatorial Bandit

🔗 More Reinforcement Learning Knowledge Cards

Actor-CriticBehavioral CloningCoT & Reasoning RLConservative Q-Learning