A Contextual Bandit extends MAB with an observable context feature xt∈Rd per round; the policy π(x) picks an action given features, maximizing the conditional expected reward E[r∣x,a]. The representative algorithm LinUCB assumes a linear reward model rt,a=θaTxt,a+ϵ, estimates per-arm parameters by ridge regression θ^a=(XaTXa+λI)−1XaTya (Xa/ya: arm a's historical feature matrix and reward vector, λI the regularizer), builds the confidence bound pt,a=θ^aTxt,a+αxt,aT(XaTXa+λI)−1xt,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 and the role of λI?
2
Compute the cost of estimating θ^a in d 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)?