Elements of RL and Multi-Armed Bandits
Elements of RL and Multi-Armed Bandits
2.1 Recap of the Previous Class and the Agent-Environment Interface
2.1.1 Definition and Explanation
Reinforcement learning is a learning paradigm that is different from both supervised and unsupervised learning, and it is the one that most closely matches the way humans actually learn — by trying things, seeing what works, and adjusting. The first class established this contrast and introduced the *agent-environment interface*, the loop at the centre of every RL problem.
The interface works as follows. The *agent* is the learner and decision-maker. The *environment* is everything outside the agent that the agent interacts with. The *agent* acts on the environment through an *action*. The environment responds in two ways: it changes its internal situation and returns a new *state* telling the agent "this is how I look now", and it optionally returns a *reward*, a number telling the agent how good the just-completed action was. So the four elementary entities are agent, environment, action, and (state, reward) — the agent talks to the environment via actions and the environment talks back via states and rewards.
- Agent observes state .
- Agent selects action .
- Environment transitions to a new internal situation and returns:
- New state
- Reward
This cycle repeats. The agent's goal is to maximise cumulative reward over time.
2.1.2 Symbol Registry
- — state — — what the environment reports after an action; domain depends on problem
- — action — — the agent's choice at a state
- — reward — — a scalar the environment returns
- — time step — — discrete decision point
2.1.3 The Five (or Six) Core Elements of RL
The five core elements of RL are:
| Element | What it is | Example (tic-tac-toe) |
|---|---|---|
| Agent | The learner and decision-maker | Your program playing X |
| Environment | Everything outside the agent | The board + opponent + rules |
| Policy () | The agent's rule for choosing actions | "If board looks like this, play there" |
| Value function | How desirable each state is | Board score: 0.9 = likely win |
| Model (optional) | The agent's representation of how the environment works | "If I play here, opponent will probably do that" |
A sixth element — the reward signal — is sometimes listed separately from the environment. The professor listed agent, environment, value function, policy, and (optionally) model.
The previous class discussed four of them but did not really develop the *model of the environment*; we cover that in section 2.3. The *value function* carries the notion of *long-term desirability of a state*: a high value state is one the agent is happy to be in, because from there it expects high future reward. In the tic-tac-toe example used previously, the value function was initialised to numbers and then iteratively updated and improved as the agent played.
2.1.4 Intuition for the Value Number
If the agent is playing crosses in tic-tac-toe and the board is in a configuration from which five winning replies are possible, the value of that state might be . That is high (the cap is ), so the state represents a configuration from which the agent will likely win. The successor move with the highest value is the move the agent should pick. At any state the agent asks: "What are all the possible actions, which states do they lead to, and what is the value of each of those resulting states?" The best action is the one that takes the agent to the highest-value state. So *having good values is the most important job of an RL learner*. This is the single most important takeaway from the previous class.
Suppose the board has three possible successor states after X's move:
- State A (play centre): value = 0.85
- State B (play top-left): value = 0.60
- State C (play bottom-right): value = 0.70
The greedy agent compares: , so it plays centre.
Sense-check: The centre cell in tic-tac-toe is indeed the strongest opening move — it participates in the most winning lines (4 out of 8: two diagonals, middle row, middle column), which aligns with the highest value.2.2 The Two Value Functions: State-Value and Action-Value
2.2.1 Why Two Flavours of Value
There are two types of value function. The *state-value function* tells the agent how desirable it is to *be* in a given state, irrespective of which action it picks next. The *action-value function* tells the agent how desirable it is to *take a specific action* *in* a specific state . The convention is strict: when we write , we mean value of a *state*; when we write , we mean value of a *state-action pair*.
The *state-value function* under policy is: This is the expected cumulative discounted reward starting from state and following policy thereafter. Here is the discount factor that trades off immediate vs. future reward.
The *action-value function* under policy is: Same idea, but conditioned on taking a specific action first, then following .
Notation note: In the MAB problem (sections 2.6–2.17), since there is no state, the state argument is dropped: .2.2.2 Symbol Registry
- — state-value function — scalar in some bounded range (here for tic-tac-toe, larger for the grid below)
- — action-value function — scalar denoting expected reward for doing in
- — current state; — next state
- — action selected in
- — discount factor — scalar in — controls how much future rewards matter relative to immediate ones
2.2.3 Worked Example: 4×4 Grid World
We assign each state a number representing its desirability, for example (quick illustrative figures): start = 0, neighbour cells carried values of 1, 6, 7, 8, 9, 10, 20, and so on up to gold at 100. These are teaching numbers, not a learned solution.
Step-by-step greedy decision:From the start state, the available actions are *up* (leading to a state with value 6) and *right* (leading to a state with value 9):
- Look at up → successor value = 6
- Look at right → successor value = 9
- Compare:
- Pick *right*
- Land in the value-9 cell, repeat the process with its neighbours.
2.2.4 The Simplification Q Provides
If instead of just we attach a number to every *state-action pair* — say and — then the agent already knows, without any look-ahead, which action is better *from this state*. It can simply read off the Q-values and pick. The action-value function *summarises* the look-ahead into a single number attached to each arrow. In grid problems the saving is small; in problems where the outcome of an action is stochastic and produces several possible next states, the saving is large.
2.2.5 The Braking-Car Analogy (Why Q Is Preferred)
If we only had , the agent would brake, observe the resulting state (stop / skid / fail), and only *then* see how valuable that state is. To choose an action intelligently *before* braking, the agent would need to enumerate all three possible next states, look up each resulting , and form an expectation.
If we instead teach the agent directly, the agent already has a single expectation baked into that arrow — a weighted average of "stops (value 10), skids (value 3), fails (value )" with weights . The agent can simply compare the -arrows of all available actions and pick the largest one without any further look-ahead.
Suppose we also have:
Then — brake is the best action. No need to enumerate successor states.
The student was asked to hold the further question on exploration-exploitation until section 2.11, where epsilon-greedy is introduced.
2.2.6 Intuition for V vs Q
| Tells you | "I would *like to be* here" | "I would *like to do this* here" |
| Requires look-ahead? | Yes — one step to compare successor values | No — value is pre-baked per action |
| Storage | One number per state: | One number per (state, action) pair: |
| Best when | Deterministic outcomes | Stochastic outcomes |
| Industry usage | Used in some policy-evaluation settings | Dominates practical algorithms |
Action values compress the one-step look-ahead into a single number per arrow, which is a real win when the look-ahead is wide or stochastic. Exam note: in textbook problems you will often be shown how to compute *both* and ; in industry practice is the one most algorithms actually use. Keep that distinction in mind.
2.3 Model of the Environment
2.3.1 Definition and Explanation
A *model of the environment* is an abstract summary of the environment's behaviour — what it returns as the next state and reward for every possible (state, action) the agent might choose. If you know, for every state and action , the probability of observing a particular next state with a particular reward , then you have a complete model of the environment. Mathematically this means you can evaluate for any .
This is a conditional probability distribution over next states and rewards , given the current state and action . It satisfies:
If the model is known, the environment is *fully characterised* — you can simulate it without ever interacting with it.
2.3.2 Symbol Registry
- — environment model — scalar in — probability of landing in with reward given action was taken in state
- , , , — already defined in 2.1.2
- — the set of all possible states
- — the set of actions available in state
2.3.3 Why a Model Is Useful
With a good model you no longer have to *estimate* values from interaction — you can compute *theoretically optimal* values using an algorithmic procedure (this will later be *dynamic programming*). The agent can plan extensively on paper before executing anything, much like an engineer or manager who exhaustively lists outcomes and probabilities before committing to a decision.
A model is not available for every problem. Real-world environments often defeat attempts to model them explicitly. But when a model exists (or can be learned), it is a powerful asset.
- The state space is small enough to enumerate (tic-tac-toe, small grids).
- The transition dynamics are known or can be learned from data.
- The environment is stationary (the dynamics don't change over time).
A model becomes impractical when:
- The state space is enormous (Go: board positions).
- The dynamics are too complex to model accurately (real-world robotics).
- The environment is non-stationary and the model would need constant updating.
2.3.4 Student Doubt: Is It Still RL If You Have a Model?
We will discuss this distinction at length later. For now, the takeaway is: a model is a fancy thing useful for toy problems, and even when you have one you may not want to use it because the optimal solution is too expensive to compute.
2.4 Model-Based vs Model-Free RL
2.4.1 Definition and Explanation
RL algorithms split into two broad categories by how they treat the model. *Model-based algorithms* assume a model of the environment is given, *or* learn a model and then use it. *Model-free algorithms* — such as policy-gradient methods and Q-learning — do not use a model; they learn directly from interaction.
| Model-Based | Model-Free | |
|---|---|---|
| Uses a model? | Yes (given or learned) | No |
| Learns from | Planning with the model | Direct interaction with environment |
| Examples | Dynamic programming, MCTS | Q-learning, SARSA, policy gradient |
| Strength | Sample-efficient (fewer interactions needed) | Simpler, no model required |
| Weakness | Model can be wrong or expensive to build | Requires many interactions |
2.4.2 A Quick Map
- Model-based: model given (then plan) or model learned (then use it to plan)
- Model-free: Q-learning, policy-optimisation methods, etc.
This lecture will not develop these in detail because doing so hand-waves too much; we revisit them once the foundations are solid.
2.4.3 Named Reference
The standard RL textbook — Sutton & Barto, *Reinforcement Learning: An Introduction* — was described as *by far the best in RL* and *the textbook for this course*. Even for deep RL, its foundations remain foundational. The rest of the course material comes from research papers.
2.5 Course Logistics, Assessment, and Deep RL Preview
2.5.1 Course Structure
The course is conceptual and mathematical, deliberately rooted in foundations rather than rushing to deep RL. About 60% of the course is on conceptual RL; deep RL is layered on top once foundations are in place. Exam note: the journey can feel theory-heavy but the payoff is well worth it according to past student feedback.
2.5.2 Assessment
- Two quizzes, each worth 5%; the final grade uses the *better* of the two. (Technically two 5% quizzes are conducted; the higher of the two counts.) No make-up exams, so plan around the 5-day live window for each quiz.
- Two group assignments; combined weight 25%; split roughly 10–12% before midterm and 13–14% after.
- Webinars delivered by senior teaching assistants give hands-on practical exposure; reach out to them for practical doubts.
2.5.3 From RL to Deep RL with a Toy Example
To show how a tabular RL solution becomes *deep* RL, take the tic-tac-toe value function from the previous lecture. The value function is a map: . Originally that map is a *table*, with one entry per state. Now *parameterise* the same function with a *neural network*: a network takes a state as input, applies parameters , and returns a value . The goal of learning becomes: adjust so that returns good estimates of the true value of for every state . If you swap the value table for a neural network — and learn the parameters — you have a *deep RL* solution to tic-tac-toe.
- Board state = "XO_\_X\_\_O\_" → look up table entry →
- One entry per possible board configuration.
- Board state encoded as a vector (e.g., ) → feed into network with weights → output
- Same network generalises across *all* states, even ones never seen in training.
2.5.4 Symbol Registry — Parameterised Value Function
- — parameters of the value network — vector — learned by gradient descent
- — parameterised state-value function — scalar
- — already defined in 2.1.2
More generally, in a classic RL framework, if you bring deep-learning components into one or more of the agent's pieces (value function, policy, or model), the result is a *deep reinforcement learning* solution.
2.6 Multi-Armed Bandit Problem (MAB): Setup and Motivation
2.6.1 The Casino Analogy
Picture walking into a casino with K slot machines — say four machines, each with one arm (a lever). You pay for coins, choose one machine, insert a coin, and pull the lever. With high probability the machine swallows your coin; occasionally it pays back, sometimes substantially more than what you spent. The *one-armed bandit* is one such machine; a *multi-armed bandit* is the K-armed version where you must decide which arm to pull at each step.
This is why the term is used: the bandit *takes everything* — almost 99% of players leave with nothing; a tiny fraction gets a payout. Hence the name "bandit".
2.6.2 Symbol Registry
- — number of arms — positive integer (e.g., 4 or 10)
- — the action of choosing arm ,
- — discrete time-step index,
- — reward obtained at time — scalar
- or — *true* (unknown) expected reward of arm — scalar
- — our *estimate* of at time — scalar
2.6.3 Formal Setup
The MAB problem is defined by:
- arms; choosing arm is the action .
- Each arm has a *reward distribution* — an unknown probability distribution from which its reward is sampled.
- Pulling arm at time gives a reward drawn from that arm's distribution.
- The reward distribution of each arm is NOT known to the learner. If it were known, the problem would be like sitting an exam with the question paper already released — no learning necessary.
- The objective is to maximise the expected total reward over a horizon of pulls:
Equivalently, minimise *regret* — the gap between your cumulative reward and the reward you'd have earned by always pulling the best arm.
2.6.4 Strategy and the Two Key Questions
The strategy has two halves: (i) you must *identify* the arm with the highest expected reward (the "best" arm), then (ii) keep *pulling* that lever to maximise your cumulative score. This raises two questions:
- How do you *identify* the best arm in the first place without knowing the distributions?
- How do you define "best"?
2.6.5 Why This Topic Matters in an RL Course
MAB is a *precursor* to a full RL problem. It is a deliberately simple, *stateless* setup that lets us study the same elements — action selection, estimation, exploration vs exploitation, learning from rewards — without the additional machinery of states. Once we are comfortable here, the jump to full RL is much easier.
2.7 MAB Is "Stateless": Action-Value Without State
2.7.1 The Notation Exception
In a full RL problem, the action-value function is — a function of *both* state and action, paired. The state-value function is . This was a hard rule in the previous lecture.
In the *multi-armed bandit* problem, the standard form drops the state argument: we write simply . This is a *deliberate exception for this lecture only* because the MAB problem has no state.
| Problem | Action-value | State-value |
|---|---|---|
| Full RL | — value of doing in state | — value of being in state |
| MAB only | — value of pulling arm | Not defined (no state) |
The dropping of the state index is a notational convenience, not a mathematical change. It reflects the fact that in MAB, the "state" is always the same (the casino hasn't changed), so conditioning on it is meaningless.
2.7.2 Symbol Registry — MAB Notation
- — action-value function *in MAB only* — scalar; the estimate is the running average of rewards from arm
- — state-value function (full RL only) — not used in this lecture
- — state — not used in this lecture (the exception)
2.7.3 When Could a State Creep In?
This is the seam that *contextual bandits* (section 2.17) will later widen. In a contextual bandit, the agent observes some context (a "state") before choosing an arm, but the action does not affect future contexts. In full RL, the action *does* affect the next state.
2.8 The True Value of an Action and Why It Is Unknown
2.8.1 Definition of
The *true value* (sometimes written or ) of arm is:
That is, the *expected reward* of choosing arm . The wording used in class was "expected reward if that action is chosen". If dollars, it means: sometimes the arm pays 0, sometimes 1, sometimes 5, sometimes 3, sometimes 20, but *on average over many pulls* you receive 10 dollars. The expectation is the steady-state average of the arm's reward distribution.
where is the (unknown) probability density of rewards for arm . If the rewards are discrete with possible values :
The expectation is taken over the *reward distribution* of arm , which is assumed to be stationary (fixed) unless stated otherwise.
2.8.2 Symbol Registry
- , — true (unknown) expected reward of arm — scalar
- — reward observed at time — scalar
- — action chosen at time — element of
- — expectation under the arm's reward distribution
- — reward probability density for arm
Suppose arm 3 has the following reward distribution:
- Payout = 0 with probability 0.6
- Payout = 5 with probability 0.3
- Payout = 20 with probability 0.1
Then:
So on average, each pull of arm 3 yields \$3.50. But any single pull might give \$0, \$5, or \$20 — you never observe the \$3.50 directly.
2.8.3 Why Estimation Is Needed
You cannot read off the machine. The casino conceals the reward distribution forever; only by pulling repeatedly and observing rewards can you draw closer to it. Hence our *learning target* is a sequence of estimates that converge to .
2.9 Sample-Average Estimation
2.9.1 The Idea
The simplest estimator of is the *sample average*: every time you pull arm , record the reward; the running average of the rewards is your current estimate. So if two friends jointly take turns pulling arms and pass the slot machine back and forth, the second friend simply averages the rewards each arm has produced and reports "this is what we expect from each arm" — that average is the estimate.
where:
- The numerator is the sum of all rewards obtained from pulling arm before time .
- The denominator is the number of times arm was pulled before time .
- The *indicator* equals 1 if action was chosen at step , and 0 otherwise. It acts as a filter: only rewards from arm contribute to the sum.
This is the arithmetic mean of the rewards observed for arm .
Action-value methods operate in a continuous 4-step loop at every decision point :
- Maintain estimates: Keep a current action-value estimate for each of the arms.
- Select an action: Choose action using an action-selection rule (e.g., greedy or -greedy).
- Observe reward: Receive numerical reward generated by arm 's reward distribution.
- Update only the selected action: Revise the estimate using . Unselected arms retain their previous estimates.
2.9.2 Symbol Registry
- — running estimate of at time — scalar
- — reward obtained at step — scalar
- — action chosen at step — element of
- — indicator function: 1 if condition true, 0 otherwise
2.9.3 Incremental Update Formula
Storing all past rewards wastes memory. The textbook (Sutton & Barto, Eq. 2.3) gives an *incremental* form that updates the estimate with constant memory and computation per step:
where is the number of times this arm has been pulled, is the current estimate, and is the latest reward.
Derivation:Interpretation: The new estimate is the old estimate plus a correction term: . The correction shrinks as grows, so early pulls have more influence and later pulls fine-tune.
This is an instance of the general form: which recurs throughout RL.
2.9.4 Concrete Numerical Mini-Example
| Arm | Pulls | Rewards | Average |
|---|---|---|---|
| 1 | 3 | ||
| 2 | 3 | ||
| 3 | 3 | ||
| 4 | 1 |
Total pulls = 3 + 3 + 3 + 1 = 10, so the next decision is at .
The estimated values at :
A *greedy* agent picks .
Sense-check: Arm 1 looks best with the highest average, but it had a lucky +5 in only 3 pulls — we might be misled.Suppose three candidate actions yield the following observed sequence of rewards:
| Action | Observed Rewards | Sample-Average Estimate |
|---|---|---|
Insight: Here and are tied at an estimated value of . Under a greedy selection rule, ties are broken arbitrarily. Further exploration is necessary to determine which action is truly superior.
2.9.5 Second Numerical Story: The "Secret Truth"
(The true values of and are not specified in the lecture.)
Our estimates at tell a very different story:
- but → over-optimistic by 1.5
- but → over-pessimistic by 1.5
A *greedy* agent would keep pulling (it looks best) and *never* discover that is actually the best arm. The agent has been misled by the limited sample.
Key insight: With only 3 pulls per arm, the sample averages are noisy. Arm 1 happened to get a lucky +5; arm 3 happened to get unlucky draws. A pure greedy strategy locks in these early, unrepresentative impressions.2.10 Greedy Action Selection
2.10.1 Definition
*Greedy action selection* always picks the action with the currently highest estimated value:
This is exploitation without exploration. If all estimates are tied (e.g., all zeros at ), the tie is broken arbitrarily.
where returns the action that maximises . Ties are broken arbitrarily (e.g., uniformly at random among tied actions).
- , , ,
- , so (pull arm 1)
- At , if arm 1 returns reward 0, the new estimate:
- Still the highest, so greedy pulls arm 1 again. And again. Forever.
In the 10-armed testbed (section 2.14), the greedy method finds the optimal action in only about one-third of problems. In the other two-thirds, its initial samples of the optimal action were disappointing, and it *never returns to it*.
2.11 -Greedy Action Selection
2.11.1 Definition and Explanation
-greedy (read "epsilon-greedy") *behaves greedily most of the time, but with a small probability , chooses an action uniformly at random*. Here is a hyperparameter in : with probability take the greedy action; with probability pick uniformly among *all* arms (including the greedy one). The wording used in class: "behave greedily most of the time, but once in a while, with a small probability, choose actions randomly independent of their estimated value so far".
Key properties:
- Every arm has a nonzero probability of being selected at every step.
- As , every arm is sampled infinitely often, so all converge to .
- The probability of selecting the optimal action converges to at least (see section 2.12).
2.11.2 Symbol Registry
- — exploration rate — scalar in (e.g., 0.4, 0.1, 0.05, 0.01)
- — current estimate of
- — the action with the highest estimated value
- — fraction of steps that exploit (greedy)
2.11.3 Interpretation of Common Values
| Exploit steps (approx.) | Explore steps (approx.) | Behaviour | |
|---|---|---|---|
| 0 | 100 | 0 | Pure greedy — no exploration |
| 0.01 | 99 | 1 | Minimal exploration — very slow learning |
| 0.1 | 90 | 10 | Moderate exploration — good balance |
| 0.4 | 60 | 40 | Heavy exploration — lots of random actions |
itself can be tuned — start larger and decay to smaller over time.
2.11.4 Why ε-Greedy Is Popular
-greedy is one of the most popular ways to balance exploration and exploitation. The single number controls all the trade-off you need. Keep that idea in mind.
2.12 Worked Examples: Probability the Greedy Arm Is Selected
2.12.1 Example 1 — Two Actions,
The ε-greedy rule splits into two branches:
Branch 1 — Greedy (probability ):- We always pick the greedy action .
- Contribution to :
- We pick uniformly among both arms, so each gets of the exploration probability.
- Contribution to :
- Contribution to :
Sense-check: The greedy action gets 75% of the probability — it's favoured but not guaranteed.
2.12.2 Example 2 — Four Actions,
- Contribution to :
- Pick uniformly among *all four arms* (including ):
- Each arm gets
Sense-check: . ✓
2.12.3 Example 3 — Detailed 4-Armed Bandit with
| Selection Component | Probability & Meaning |
|---|---|
| Random Exploration Probability | (Random action chosen 20% of the time) |
| Direct Greedy Choice Probability | ( directly chosen 80% of the time) |
| Per-Action Exploration Share | (Each arm receives 5% prob via exploration) |
| Total Probability of Greedy Arm | (85%) |
| Total Probability of Each Non-Greedy Arm () | (5% each) |
Takeaway: The greedy arm can also be picked during the random exploration phase. Thus its overall selection probability is .
2.12.3 Symbol Registry
- — the candidate actions (arms)
- — the greedy arm (the arg-max) — single element
- — exploration rate (already defined in 2.11.2)
- — selection probability of action — scalar in
- — number of arms (already defined in 2.6.2)
2.12.4 Probability of Greedy Action — Formal Derivation
Let be the unique greedy action among arms. Using the law of total probability:
For any *non-greedy* action :
| Example | Matches? | |||
|---|---|---|---|---|
| Example 1 | 2 | 0.5 | ✓ | |
| Example 2 | 4 | 0.4 | ✓ |
2.13 Formal ε-Greedy Algorithm (Pseudocode)
2.13.1 Procedure
Set small (e.g., 0.05). At each time step:
- Draw a uniform random number .
- If : exploit — select .
- If : explore — select uniformly at random from all arms.
function get_action(Q, ε): u ← random.random() # uniform in [0, 1) if u > ε: A ← argmax_a Q(a) # exploit else: A ← random over all actions # explore return A
| Step | ? | Action | |
|---|---|---|---|
| 1 | 0.82 | Yes | exploit: pick argmax |
| 2 | 0.03 | No | explore: pick random arm |
| 3 | 0.91 | Yes | exploit: pick argmax |
| 4 | 0.67 | Yes | exploit: pick argmax |
| 5 | 0.01 | No | explore: pick random arm |
About 5% of steps explore, 95% exploit — matching .
2.13.2 Symbol Registry
- — sample from — scalar
argmax_a Q(a)— action with the maximum current estimaterandom— uniform distribution over arms- — threshold below which we explore (e.g., 0.05 → 5% of the time)
2.13.3 Student Doubt on the Random Function
random can return *any* value in , what if it returns the
*same* number every step (e.g., always 0.8)? Doesn't that break the 60/40 split we expect?
A: No — the expectation of random.random() is *uniform* over . Every
real number in that interval has an equal chance of being returned. Hence the *fraction* of draws falling in
is exactly , and the fraction in is , *in expectation over many draws*. If your RNG did *not* have this uniform property the algorithm
would break, which is why it must be a proper uniform RNG. Of course, in a *single* draw any value can come up;
the guarantee is statistical, not deterministic.
2.14 The 10-Armed Testbed and Empirical Comparison
2.14.1 Setting Up the Testbed
The 10-armed bandit is a standard testbed for comparing action-selection algorithms. Each arm has its own reward distribution (so its own ). We generate 2000 different *testbeds* (2000 independent 10-armed problems); for each testbed we run the algorithm for 1000 steps; we average the per-step reward across all 2000 testbeds. This gives a clean empirical curve showing how each algorithm performs over a horizon.
- For each of 2000 independent runs:
- Draw 10 true action values: for .
- These are the *hidden* expected rewards of the 10 arms.
- At each time step :
- The algorithm selects arm .
- The reward is drawn: — the actual reward is noisy, centred on the true value.
- After all 2000 runs, average the reward at each time step across runs.
This setup ensures that:
- Each arm has a different, unknown true value.
- Rewards are noisy (variance 1), so single pulls are unreliable.
- Averaging over 2000 runs gives a statistically stable performance curve.
2.14.2 Symbol Registry
- — fixed number of arms for this testbed
- — horizon (steps per run)
- 2000 — number of independent testbeds averaged
- — initial estimate for every arm
- — the three settings compared
2.14.3 Initialisation
Each algorithm begins with for all arms. Whichever arm we sample first returns some reward — say or — and that arm's estimate is updated to the running average from then on.
2.14.4 The Three Algorithms Compared
The figure has two panels:
Upper panel — Average reward vs. steps:| Algorithm | Colour | Behaviour | At step 1000 |
|---|---|---|---|
| Greedy () | Green | Rises quickly at first, then plateaus at ~1.0 | Low plateau |
| Red | Rises slowly, still climbing at step 1000 | ~1.3, still rising | |
| Blue | Rises steadily, clear winner at step 1000 | ~1.5 (near optimal ~1.55) |
| Algorithm | At step 1000 |
|---|---|
| Greedy | ~33% — found optimal in only 1/3 of problems |
| ~70% and still climbing | |
| ~91% — nearly always picking the best arm |
2.14.5 Takeaways on Tuning ε
The practical advice from the lecture is:
- Start with a larger (more exploration) when you know little.
- Decay as your estimates stabilise.
- Never bring down to exactly 0. Even with a near-perfect policy, if you stop exploring altogether and become permanently fixated on what you currently believe is best.
- In a non-stationary environment where the underlying reward distribution changes with time (your user's tastes change), you must keep at a small positive number *forever* to react to those changes.
If the rewards are truly stationary, you can in principle drive close to zero — but never to zero, because you can rarely say with absolute certainty that you have cracked the distribution.
- Early estimates can mislead: A genuinely optimal action may look poor if its initial reward sample happens to be low due to environmental noise.
- Greedy selection settles prematurely: Once a greedy agent commits to an early leader, it stops testing alternatives and never returns to actions that were initially underestimated.
- -greedy restores reliability: Periodic random actions ensure that less-tested options get evaluated, allowing the agent to correct early misleading estimates.
- Exploration has a short-term cost for long-term gain: Random actions may reduce immediate reward in early steps, but they yield significantly higher cumulative reward over long horizons by discovering the optimal arm.
2.15 Stationary vs Non-Stationary Rewards
2.15.1 Definition and Explanation
A *stationary* reward distribution is one that does not change over time; the underlying is fixed. A *non-stationary* reward distribution is one that drifts, even if the agent and the environment are unchanged.
| Stationary | Non-stationary | |
|---|---|---|
| over time | Fixed: | Drifting: changes with |
| Sample average | Converges to true value | May converge to a *stale* value |
| Exploration needed? | Eventually is OK | forever |
| Example | Fair die (always 1/6 per face) | User preferences (shift with life stage) |
2.15.2 Intuition: Same User, Different Tastes
This is the proper definition of non-stationarity — even in a single-user model:
- Stationary: assume reward distribution is fixed; once you learn it you are done (mostly).
- Non-stationary: rewards drift over time, so to keep current you must *continue to explore at a small rate forever*.
The sample average gives equal weight to all past rewards. In a non-stationary environment, old rewards become stale — a reward from 3 years ago may be irrelevant to today's distribution. The fix is to use a *constant step size* instead of :
This gives exponentially decaying weight to old rewards: recent observations dominate. With , a reward from 10 steps ago contributes only as much as the most recent reward.
2.16 Real-World Applications of MAB
2.16.1 Online Advertising and Product Recommendation
A simplified "naive Amazon" recommendation banner shows 10 products at a time from a catalogue of millions. A click is one reward; a purchase is a higher reward. Each candidate item is an *arm*; its reward distribution depends on the user and is unknown to the platform. The platform iteratively tries items, updates each item's average click/reward rate, and survives by pushing items with higher observed rates. Items never clicked get pruned; new items keep entering. The platform *doesn't know* what *I* will click on next — my reward distribution is unknown and is being learned from interaction.
| MAB Concept | Ad/Recommendation Analogue |
|---|---|
| Arm | A candidate product or ad |
| Pull | Showing the product to the user |
| Reward | Click (small reward) or purchase (large reward) |
| True click-through rate of product | |
| Exploration | Trying new or rarely-shown items |
| Exploitation | Showing the product with the highest observed CTR |
2.16.2 Cloud Configuration and Resource Allocation
A cloud platform regularly selects server, cache, or database configurations for microservices. Candidate configurations represent arms (), and the numerical reward is measured as throughput, negative latency, or cost-adjusted performance score. The system learns which configuration yields the best average performance without shutting down services for exhaustive benchmark testing.
A platform tests three cache configurations with observed performance scores:
- :
- :
- :
A greedy selection rule picks (score 75.0). Continuous -greedy exploration ensures configuration is re-tested periodically in case workload patterns shift.
2.16.3 Detecting a Biased Coin
A student proposed a "biased coin" as a 1-armed bandit: toss the same coin repeatedly, label heads as 1 and tails as 0, and average. If the long-run average is exactly 0.5 the coin is unbiased; if it stays above 0.5 it is biased toward heads and below 0.5 toward tails. The lecturer noted this is *technically* a K-armed bandit with (a "one-armed bandit"). Strictly speaking it is trivial, because there is only one action and hence no choice — proper MABs need at least two arms.
Flip a coin 10 times: H, H, T, H, T, H, H, T, H, H → 7 heads, 3 tails. Running average after flips: .
Is the coin biased? With only 10 samples we can't be sure. After 1000 flips with 700 heads, we'd be much more confident that .
Connection to MAB: This is a single-arm estimation problem — there's no choice to make, just estimation. It illustrates the *estimation* component of MAB without the *selection* component.2.16.3 Clinical Trials
Suppose you have several candidate drugs/treatments to try, a limited number of patients, and you do not yet know which treatment is best. Each regimen is an *arm*; patient response is the *reward*. You keep trying until you accumulate enough evidence to push the bulk of trials to the treatment with the highest response — but you *still* must keep exploring to refine estimates.
2.16.4 Simple Portfolio Management
A simplified portfolio of 10 stocks where you have actions *buy / sell / hold* producing rewards. Each action is an arm and we learn its expected reward. Without context this is rather toy; full portfolio management is a more complex agent with state.
2.16.5 Why Amazon Can Sometimes Surprise Us
Amazon might model my *account*, but my account is used by me, my spouse, my child, my parents; my purchase patterns shift as life stages change. Exam note: the lecturer emphasised these illustrate *why exploration is forever*, not a one-time startup phase — even when you think you have "nailed" a user.
2.16.6 When Is MAB Not Enough? Sports, Games, Driving
2.17 Contextual Bandits and the Bridge to Full RL
2.17.1 Definition and Explanation
A *contextual bandit* extends MAB by adding a *context* — extra information observed before each action — but *still without* the agent's action affecting future contexts. The reward distribution of an arm depends on this context; the agent learns a policy .
In a contextual bandit, at each step :
- The agent observes a *context* (also called "side information" or "features").
- The agent selects arm .
- The agent receives reward drawn from a distribution that depends on *both* and .
- Crucially: the agent's action does *not* affect the next context . Contexts arrive exogenously.
The policy is a mapping: , where is the context.
2.17.2 Why It Differs From MAB and Full RL
| Feature | Vanilla MAB | Contextual Bandit | Full RL |
|---|---|---|---|
| State/context? | None | Yes () | Yes () |
| Action affects next state? | N/A | No | Yes |
| Reward depends on | Arm only | Arm + context | Arm + state |
| Policy | (fixed) | ||
| Example | Slot machine | Ad recommendation given user features | Chess, driving |
| Sequential? | No | No (each step independent) | Yes (current action changes future) |
2.17.3 Why This Matters
- News recommendation: context = user profile + time of day; arms = articles; reward = click.
- Personalised medicine: context = patient demographics + history; arms = treatments; reward = outcome.
- Dynamic pricing: context = demand + competitor prices; arms = price points; reward = revenue.
MAB is studied partly to learn the basic RL elements — action-selection, value estimation, exploration vs exploitation, stationary vs non-stationary — in the simplest possible setup, *before* the full MDP machinery. Once you can handle MAB confidently, full RL with states becomes much easier to reason about.
2.18 Self-Assessment & Numerical Practice Questions
Test your understanding of multi-armed bandits, sample-average updates, and -greedy action selection with these end-of-topic review problems adapted from Sutton & Barto and course material.
Problem: Define the -armed bandit problem. State the learner’s objective and explain why the problem is described as a "one-situation" decision problem.
Solution / Answer:
- Definition: A -armed bandit problem is a simplified evaluative-feedback decision problem where a learner repeatedly chooses one action from a set of available actions (arms) over discrete time steps . Each action yields a numerical reward drawn from an unknown reward probability distribution.
- Objective: To maximize expected total cumulative reward (or minimize total expected regret) over the decision horizon.
- Why "One-Situation": It is stateless. The environment stays in a single static situation across all time steps. The choice of action at time has no influence on future situations, states, or future reward distributions.
Problem: Explain why the feedback in a bandit problem is evaluative rather than instructive. Why does the received reward not directly reveal the best action?
Solution / Answer:
- Evaluative Feedback: Indicates how good the action taken was, but does not indicate whether it was the best action available or what rewards unselected actions would have produced.
- Instructive Feedback: Directly specifies the correct/optimal action regardless of the action taken (as in supervised target labels).
- Why reward doesn't reveal the best action: Rewards are stochastic samples. A single reward is drawn from a distribution with noise. An optimal action might yield a low reward by chance on a single pull, while a suboptimal action might yield a high reward. Without counterfactual feedback for unselected arms, repeated sampling is required to estimate expected values .
Problem: Explain the difference between the true action value and the estimate . What kind of experience is needed for to become reliable?
Solution / Answer:
- is the true, fixed, unknown expected reward of action . It is a property of the environment's reward distribution.
- is the learner's estimate of at time step , calculated from past observed rewards. It is a property of the learner's current knowledge.
- Reliability Requirement: By the Law of Large Numbers, becomes a reliable estimate of only when action has been selected and sampled a large number of times ().
Problem: A bandit has three actions. The observed rewards are: Compute the sample-average estimate for each action and identify the greedy action.
Solution / Answer:
Greedy Action: Actions and are tied with the highest estimated value of . A greedy action selection rule will break ties arbitrarily between and .
Problem: In a 5-armed bandit (), suppose and there is a single unique greedy action. What is the probability of random exploration? What is the total probability that the greedy action is selected?
Solution / Answer:
- Probability of random exploration: (20%).
- Probability of selecting greedy action :
- Each non-greedy action gets probability (4%).
Problem: In -greedy action selection with two actions () and , what is the total probability that the greedy action is selected? Show the calculation.
Solution / Answer:
- Exploitation branch probability:
- Exploration branch share per arm:
- Total probability for greedy action:
Problem: A 4-armed bandit uses -greedy action selection and sample-average estimates with initial values for all actions. Ties are broken by choosing the smallest action index. The first observations are: Identify the time steps on which random exploration definitely occurred, and time steps on which it could have occurred.
Solution / Answer:
Let's trace estimates step-by-step:
- Step 1 (): Initial estimates . All arms tied at 0. Greedy choice with smallest index is arm 1. Action taken: . Update: .
Exploration status: could be greedy (tie-break) or random exploration. - Step 2 (): Current estimates . Greedy action is any of (tied at 0). Action taken: . Update: .
Exploration status: Arm 2 was tied-highest, so could be greedy or exploration. - Step 3 (): Current estimates . Unique greedy action is arm 2 (). Action taken: .
Exploration status: Selected greedy arm 2. Could be exploitation or exploration. Result: , so . Update: . - Step 4 (): Current estimates . Greedy actions are arms 3 and 4 (tied at 0). Action taken: .
Exploration status: DEFINITE EXPLORATION! Arm 2 had estimate , while arms 3 and 4 had higher estimate . Choosing arm 2 at could only happen via random exploration! Result: , new . Update: . - Step 5 (): Current estimates . Unique greedy action is arm 2 (). Action taken: .
Exploration status: DEFINITE EXPLORATION! Arm 3 had estimate , which is lower than greedy arm 2 (). Selecting arm 3 at step 5 was a non-greedy choice, so it definitely occurred via random exploration.
Summary:
- Definitely explored: Steps and .
- Could have explored (or exploited): Steps .
Problem: A website can show one of four banners to a visitor. A click gives reward 1 and no click gives reward 0. Identify the arms and rewards in this bandit formulation. What is not observed after a banner is selected?
Solution / Answer:
- Arms (): The 4 banner variants available to display.
- Reward (): Binary indicator — if visitor clicks, if visitor leaves without clicking.
- Unobserved Counterfactuals: The rewards (click or no click) that would have occurred if any of the other 3 banners had been displayed to this specific visitor are completely unobserved.
Problem: A cloud platform tests three cache configurations. The observed performance scores are: Compute the current action-value estimate for each configuration and identify the greedy configuration.
Solution / Answer:
Greedy Configuration: Configuration has the highest current estimate (), so it is the greedy choice.
Problem: Based on the 10-armed testbed performance curves, explain why the greedy method can improve quickly at first but still perform poorly in the long run.
Solution / Answer:
- Early fast improvement: Greedy immediately exploits whichever arm gives a positive early reward, avoiding exploratory steps on arms that yield low initial rewards.
- Long-run plateau: Because greedy never explores, if the true optimal arm initially receives an unluckily low reward sample, greedy locks onto a suboptimal leader and never samples the optimal arm again. In the 10-armed testbed, greedy gets stuck on suboptimal arms in roughly 2/3 of all problems, leading to a low long-run average reward plateau (~1.0 vs ~1.55 optimal).
Problem: Compare and in the 10-armed testbed. Which one explores more often, and how does that affect early discovery of the optimal action vs. long-term performance?
Solution / Answer:
- explores 10% of the time, while explores only 1% of the time.
- Early discovery: finds the optimal action much faster early on because it samples alternative arms 10 times more frequently.
- Long-term performance: levels off at choosing the optimal action ~91% of the time (because 10% of the time it still chooses randomly). improves more slowly, but over very long horizons () it will eventually reach ~99% optimal action selection because its asymptotic penalty for random exploration is much smaller (1% vs 10%).
Exam Guidance Summary
- Lecture structure: ~60% of the course is conceptual RL foundations; deep RL comes later. The course journey may feel theoretical but is well worth it.
- Quizzes: Two quizzes, each 5%, best of two counted. No make-ups — plan around the 5-day live window for each quiz.
- Assignments: Two group assignments, 25% total split as ~10–12% pre-midterm and ~13–14% post-midterm.
- The vs. distinction: asks "how good is this state?", asks "how good is this action in this state?"
- The notation exception: MAB uses instead of because there is no state.
- Sample-average estimation formula and its incremental form .
- The -greedy probability calculation: .
- Formal ε-greedy pseudocode: draw , exploit if , explore otherwise.
- The 10-armed testbed comparison: greedy plateaus (~33% optimal), wins at 1000 steps (~91% optimal), still climbing.
- should never reach 0, especially under non-stationary rewards.
- Classification of scenarios as MAB / contextual bandit / full RL.
- Numerical worked problems on ε-greedy selection probabilities (given and , compute ).
- Short derivations (sample-average formula, incremental update).
- Conceptual questions on stationary vs. non-stationary rewards and why must stay positive.
- Application-oriented classification: given a scenario, identify whether it's MAB, contextual bandit, or full RL — and justify.
Key Industry Applications
- Recommendation and ad platforms (Amazon-style): viewing each candidate product/ad as an arm and the click or purchase as a stochastic reward. The platform maintains running estimates of each item's click-through rate and shifts traffic toward higher-performing items.
- Clinical trial design: experimental arms compared with limited patient budget; balance exploration (treating new candidates) vs exploitation (using the currently best estimate). Adaptive MAB-based trials have been used in oncology and vaccine development.
- Simple portfolio management (toy framing): buy/sell/hold as actions with stochastic returns. A simplified MAB abstraction; real portfolio management requires state (market conditions, time, holdings).
- A/B testing / web layout optimisation: different layouts or treatments as arms; MAB generalises A/B testing by continually shifting traffic toward better variants rather than committing fixed 50/50 splits. This is sometimes called "adaptive experimentation."
- Detecting a biased coin: a one-armed verification benchmark requiring many samples to estimate a Bernoulli parameter from a running average. Useful as a teaching tool and as a component of more complex systems.
- Production system monitoring under non-stationarity: adaptive agents maintaining a small but positive exploration rate permanently so they react to drifts. Cloud systems use MAB-based approaches for load balancing, feature flagging, and canary deployments.
- The standard RL textbook — Sutton & Barto, *Reinforcement Learning: An Introduction* — is described as the *best book in RL* and is the course textbook; even deep RL rests on what it covers.
- Course research papers (cited across remaining lectures) were mentioned but not specifically named this session.
DRL Lecture 2 Notes · Elements of RL and Multi-Armed Bandits
Sections Breakdown
2.1 Recap of the Previous Class and the Agent-Environment Interface
2.2 The Two Value Functions: State-Value \(V(s)\) and Action-Value \(Q(s,a)\)
2.3 Model of the Environment
2.4 Model-Based vs Model-Free RL
2.5 Course Logistics, Assessment, and Deep RL Preview
2.6 Multi-Armed Bandit Problem (MAB): Setup and Motivation
2.7 MAB Is "Stateless": Action-Value Without State
2.8 The True Value of an Action and Why It Is Unknown
2.9 Sample-Average Estimation
2.10 Greedy Action Selection
2.11 \(\varepsilon\)-Greedy Action Selection
2.12 Worked Examples: Probability the Greedy Arm Is Selected
2.13 Formal ε-Greedy Algorithm (Pseudocode)
2.14 The 10-Armed Testbed and Empirical Comparison
2.15 Stationary vs Non-Stationary Rewards
2.16 Real-World Applications of MAB
2.17 Contextual Bandits and the Bridge to Full RL
2.18 Self-Assessment and Numerical Practice Problems
Exam Guidance Summary
Key Industry Applications
Exam Revision Notes
Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.
Recap of the Previous Class and the Agent-Environment Interface
Must-know: The agent-environment interface loop: agent sends action, environment returns (state, reward). The five core elements. Good value estimates are the most important job of an RL learner.
⚠️ Top pitfall: Confusing immediate reward r with long-term value V(s). A state can have low immediate reward but high long-term value.
Self-check: Name the five core elements of RL.
Connects to: 2.2, 2.3
The Two Value Functions: State-Value \(V(s)){} and Action-Value \(Q(s,a)){}
Must-know: V(s) vs Q(s,a): V requires one-step look-ahead, Q does not. Q is preferred in stochastic environments. In practice, Q dominates industry algorithms.
⚠️ Top pitfall: Confusing V and Q. V(s) asks 'how good is this state?', Q(s,a) asks 'how good is this action in this state?'. They are not interchangeable.
Self-check: In the braking-car example, compute Q(s, brake) given P(stop)=0.9 (value 10), P(skid)=0.07 (value 3), P(fail)=0.03 (value -10).
Connects to: 2.7, 2.8, 2.9
Model of the Environment
Must-know: The model p(s',r|s,a) is the joint transition-reward distribution. RL is the MDP problem class; having a model does not mean the problem is solved — planning can still be intractable.
⚠️ Top pitfall: Assuming 'having a model' means 'solving the problem is easy'. Even with a perfect model (e.g., chess rules), optimal policy can be intractable.
Self-check: What is the environment model, and what does it allow you to do?
Connects to: 2.4, 2.1
Model-Based vs Model-Free RL
Must-know: Model-based vs model-free: model-based uses a model (given or learned) to plan; model-free learns directly from interaction. Examples: DP (model-based), Q-learning (model-free).
⚠️ Top pitfall: Assuming model-free means 'no planning at all' — some model-free methods still perform limited planning through learned value functions.
Self-check: Is Q-learning model-based or model-free? Explain.
Connects to: 2.3, 2.5
Course Logistics, Assessment, and Deep RL Preview
Must-know: Course structure: two quizzes (5% each, best of two, no make-ups), two group assignments (25% total). Deep RL = tabular RL + neural network function approximator.
⚠️ Top pitfall: Assuming deep RL is fundamentally different from tabular RL. Same problem, same elements — just a different representation.
Self-check: What is the single change that turns tabular RL into deep RL?
Connects to: 2.6, 2.1
Multi-Armed Bandit Problem (MAB): Setup and Motivation
Must-know: MAB: K arms, unknown reward distributions, maximise cumulative reward. Core challenge: exploration vs exploitation.
⚠️ Top pitfall: Thinking one pull per arm is enough to identify the best arm. Noisy samples require multiple pulls.
Self-check: What is the objective in the MAB problem?
Connects to: 2.7, 2.8, 2.9
MAB Is "Stateless": Action-Value Without State
Must-know: MAB uses Q(a) instead of Q(s,a) because there is no state. This notation exception applies only to MAB.
⚠️ Top pitfall: Writing Q(s,a) or V(s) in an MAB problem — both are undefined without a state.
Self-check: Why does MAB write Q(a) instead of Q(s,a)?
Connects to: 2.8, 2.17
The True Value of an Action and Why It Is Unknown
Must-know: q*(a) = E[R_t | A_t = a] is the true expected reward. It is fixed but unknown; Q_t(a) is our running estimate that should converge to it.
⚠️ Top pitfall: Confusing q*(a) (true, fixed, unknown) with Q_t(a) (estimate, changes over time).
Self-check: What is the difference between q*(a) and Q_t(a)?
Connects to: 2.9, 2.6
Sample-Average Estimation
Must-know: Sample-average formula with indicator notation. Incremental update: Q_{n+1} = Q_n + (1/n)[R_n - Q_n]. Per-arm averaging. Early estimates are noisy and can mislead greedy selection.
⚠️ Top pitfall: Averaging across all arms instead of per arm. Assuming a few pulls give reliable estimates.
Self-check: Given rewards for arm 2: 0.5, 0.5, -1.5, what is Q(2)?
Connects to: 2.10, 2.11, 2.8
Greedy Action Selection
Must-know: Greedy: A_t = argmax Q_t(a). No exploration — once an arm leads, it's pulled forever.
⚠️ Top pitfall: Pure greedy gets stuck on early lucky estimates. Only finds optimal action in ~1/3 of problems in the 10-armed testbed.
Self-check: Why does pure greedy fail to find the best arm in most problems?
Connects to: 2.11, 2.12
\(\varepsilon){}-Greedy Action Selection
Must-know: ε-greedy: with prob 1-ε pick greedy action, with prob ε pick uniformly at random. All arms have nonzero selection probability. ε=0 is pure greedy.
⚠️ Top pitfall: Setting ε too high wastes steps; too low means insufficient exploration. ε=0.1 is a common starting point.
Self-check: What happens when ε=0? When ε=0.5?
Connects to: 2.12, 2.13, 2.14
Worked Examples: Probability the Greedy Arm Is Selected
Must-know: P(greedy) = 1 - ε + ε/K. P(non-greedy) = ε/K. The greedy arm is always eligible during exploration — split ε/K among all K arms, not K-1.
⚠️ Top pitfall: Splitting exploration probability among K-1 arms instead of K. The greedy arm is eligible during exploration too.
Self-check: For K=10, ε=0.1, what is P(greedy arm)?
Connects to: 2.13, 2.14
Formal ε-Greedy Algorithm (Pseudocode)
Must-know: ε-greedy pseudocode: draw u~U(0,1), if u>ε exploit (argmax), else explore (random).
⚠️ Top pitfall: Confusing the threshold ε with something other than the exploration probability — they are identical.
Self-check: Trace the ε-greedy algorithm for 3 steps with ε=0.1 and u values 0.5, 0.08, 0.95.
Connects to: 2.14
The 10-Armed Testbed and Empirical Comparison
Must-know: 10-armed testbed: 2000 runs, 1000 steps. ε=0.1 is winner at 1000 steps (~91% optimal, ~1.5 avg reward). Greedy ~33% optimal. ε=0.01 still climbing. Never set ε=0.
⚠️ Top pitfall: Thinking greedy is 'good enough'. It finds the optimal action only ~1/3 of the time in the 10-armed testbed.
Self-check: In the 10-armed testbed, which ε value performs best at step 1000? Why does ε=0.01 not win?
Connects to: 2.15, 2.11
Stationary vs Non-Stationary Rewards
Must-know: Stationary = fixed distributions. Non-stationary = drifting. Under non-stationarity: constant step size α, ε>0 forever. Sample averages give equal weight to stale data.
⚠️ Top pitfall: Setting ε=0 in non-stationary environments. Using sample averages when rewards drift.
Self-check: Why can't you set ε=0 in a non-stationary environment?
Connects to: 2.16, 2.14
Real-World Applications of MAB
Must-know: Applications: ads, clinical trials, A/B testing. MAB is for stateless problems. Board games, driving, sports require state → contextual bandit or full RL.
⚠️ Top pitfall: Applying MAB to stateful problems (chess, driving). If action value depends on context, MAB is insufficient.
Self-check: Why is chess not a suitable MAB problem?
Connects to: 2.17, 2.15
Contextual Bandits and the Bridge to Full RL
Must-know: MAB: no context. Contextual bandit: context exists, action doesn't affect future context. Full RL: action affects future state. Contextual bandits bridge MAB and full RL.
⚠️ Top pitfall: Confusing contextual bandits with full RL. In contextual bandits, the next context is independent of the action taken.
Self-check: What is the key difference between a contextual bandit and full RL?
Connects to: 2.7, 2.6
Exam Guidance Summary
Must-know: V vs Q, sample-average formula, ε-greedy probability P(A*)=1-ε+ε/K, ε never reaches 0, MAB vs contextual bandit vs full RL classification.
⚠️ Top pitfall: Splitting ε among K-1 arms instead of K. Setting ε=0.
Self-check: For K=5, ε=0.2, what is P(greedy arm)?
Connects to: 2.12, 2.14, 2.15
Key Industry Applications
Must-know: Applications: ads, clinical trials, A/B testing, production monitoring. Key reference: Sutton & Barto.
⚠️ Top pitfall: Confusing toy MAB applications (portfolio) with the real thing (which requires state).
Self-check: Name two real-world applications of MAB and explain why each is a stateless problem.
Connects to: 2.16, 2.17
Was this lecture useful?
BitsNotes AI Assistant
Subject Notes AssistantConfigure AI Chat
Choose how to access the chatbotSigned in as
Powered by BitsNotes — 20 messages per day. No API key needed. Want unlimited access? Use "Bring Your Own Key" mode.
Sign in to use AI Chat
Get 20 free AI messages per day to ask questions about your lecture notes. Sign in with Google or GitHub — it takes 5 seconds.
Sign In to BitsNotesSwitch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.