liveBook · Manning

Contextual bandit

As explained in Machine Learning System Design

A sequential decision method that selects an action using the observed context and learns its outcome or reward.

A contextual bandit chooses among available actions using observed context, then uses the resulting feedback to pursue a reward. In recommendation systems, an agent consumes a user’s recent history and selects an ad banner, while optimizing measures such as click-through rate, conversion rate, or eCPM. Because shown ads influence later behavior, the decision process has a feedback loop. section 12.1.3

A practical contextual-bandit setup includes:

  • User context, such as recent history. section 12.1.3
  • Available items or ads, treated as alternative actions. section 12.1.3
  • Observed feedback, which may be binary or continuous. section 12.1.3
  • Historical replay for simulating recommendations and evaluating policies offline. section 12.1.3
Figure 12.1 Unbiased estimator (offline validation): stream of real events
figure

Use the event-stream figure to contrast real recommendation events with their offline validation setting. section 12.1.3

How Machine Learning System Design covers it

How deep it goes
Explains the agent, context, actions, feedback loop, and replay simulation, but does not derive bandit algorithms.
Examples
Uses ad-banner selection with user history and CTR, CVR, or eCPM as reward measures.
What it assumes
Assumes familiarity with user features, available recommendations, observed feedback, and agent-environment interaction.
What you can do after
Evaluate recommendation policies offline by constructing a historical replay simulation.
How it connects
Connects contextual bandits with recommender systems, multi-armed bandits, reinforcement learning, and offline evaluation.

Also explained in

Compare how 3 books explain contextual bandit →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning System Design. The section links point to the parts of the book it draws on.