Learning from Actions (continued)

ECE 57000 — November 20, 2026

David I. Inouye

A chosen action gives reward and information

  • A reward evaluates the chosen action; it does not label the best alternative.
  • Sample averages estimate value, with uncertainty that depends on the trials collected.
  • Greedy choices can preserve an early mistake; exploration can improve later choices.

Today: finish exploration, then follow actions that change the next decision.

When is trying an uncertain banner worth it?

C has the highest estimated play rate. E has had few impressions. When is trying E most valuable?

A. Many similar viewers will arrive.

B. All six banners will be replaced tomorrow, before the next viewer.

C. This is the final viewer.

A. Exploration has value when information can improve future decisions. A longer horizon gives the learner more chances to use what it learns.

Exploration gives other banners a chance to earn a play

  • Greedy starts each estimate at zero and chooses a highest estimate.
  • Optimistic greedy starts each estimate at one. An early failure lowers that estimate, so an untried banner becomes more attractive.
  • Epsilon-greedy usually chooses a leader and otherwise samples uniformly. Compare exploration probabilities 0.05 and 0.20 against the uniform random baseline.

Which policies learn to show banner E more often?

Share of choices going to E across rounds for five policies.

Early trials can correct a misleading estimate. Uniform sampling keeps choosing E about once every six rounds.

Bandit feedback can be delayed even when only one action earns the reward

Time Event Reward for showing E E plays / completed trials
4:00 Show E Pending 10/100
4:03 No play yet Pending 10/100
4:08 Viewer presses play 1 11/101

If the ten-minute window had closed without a play, the update would be 10/101.

Feedback delay changes when an estimate can be updated. With one action per viewer, the eventual reward still has a known action to evaluate.

When does a banner choice become a sequential decision?

A contextual bandit can choose a different banner for each audience

Suppose half the viewers are new and half are returning. Before showing a banner, we learn which group the viewer belongs to.

Hypothetical play rate Banner C Banner E
New viewer 14% 6%
Returning viewer 6% 18%
All viewers 10% 12%

Always showing E gives 12 plays per 100 viewers on average. Showing C to new viewers and E to returning viewers gives 7 + 9 = 16.

Context changes which action has the highest expected reward. The learner still makes one choice per viewer and observes only that choice’s reward.

A banner can change which decision comes next

Now the viewer can open the title page. Netflix chooses a trailer only if the page opens. A play still earns 1.

Possible path after showing C Next decision Final reward
Viewer leaves Visit ends 0
Viewer opens the page Show the action trailer → viewer leaves 0
Viewer opens the page Show the comedy trailer → viewer plays 1

To judge banner C, we need to know how often it gets viewers to the page and what happens under the trailer policy once they arrive.

Sequential RL tracks how actions change the next state. An action’s value includes rewards earned after later decisions.

One visit gives a sequence of states, actions and rewards

Suppose a viewer sees banner E, opens the title page, watches the comedy trailer and presses play.

Step State before the choice Action Netflix takes Next state Reward
0 Browsing Show E On title page 0
1 On title page Show comedy trailer Visit ended 1

The viewer’s response determines where the visit goes. A viewer who leaves after E ends the visit at step 0 with reward 0.

A trajectory records the interaction in order. From state \(\textnormal{S}_t\), the agent chooses \(\textnormal{A}_t\), then observes \(\textnormal{S}_{t+1}\) and \(\textnormal{R}_{t+1}\).

A state must retain the history that matters for prediction

Two viewers reach the same title page, one through C and one through E. Both see the comedy trailer.

Suppose earlier artwork… What state would we use on the page?
Has no further effect on how viewers respond On title page can describe both visits.
Still affects which trailer a viewer responds to Keep on title page after C and on title page after E distinct.

The Markov assumption says that given the current state and action, earlier history adds no information about the distribution of the next state and reward.

The policy chooses a banner while browsing and a trailer on the page

① Our choice · Browsing → show E. On the page → choose comedy with probability ½, otherwise action.

② Viewer response · After E, 30% reach the page and 70% leave. Either outcome earns 0 immediately.

③ Reward and next state · Both trailers end the visit. Comedy earns a play with probability 0.50 and action with probability 0.40.

Two distributions generate a visit, starting from an initial state

Start with \(S_0\sim\rho_0\), where \(\rho_0(s)\) is the probability of starting in state \(s\). Here every visit starts in browsing.

① The agent controls the policy \(\pi(a\mid s)=\Pr(A_t=a\mid S_t=s)\).

②③ The environment supplies the dynamics \(p(s',r\mid s,a)=\Pr(S_{t+1}=s',R_{t+1}=r\mid S_t=s,A_t=a)\).

The MDP specifies states, available actions and environment dynamics. Choosing a policy determines how the agent interacts with it.

Repeating the two draws defines a trajectory

\[S_0 \xrightarrow{\pi} A_0 \xrightarrow{p} (R_1,S_1) \xrightarrow{\pi} A_1 \xrightarrow{p} (R_2,S_2)\longrightarrow\cdots\]

① The current state determines which action distribution to use.
② The current state and chosen action determine the next outcome distribution.
③ The next state and reward are drawn jointly. The next state becomes the input for the following choice.

An episode stops at a terminal state. A continuing task can generate an infinite sequence.

Multiply the policy and environment probabilities along one visit

Path: browsing → E → page (0) → comedy → ended (1).

\[\begin{aligned} \Pr(\text{this path})={}&\rho_0(\text{browsing})\,\pi(E\mid\text{browsing})\,p(\text{page},0\mid\text{browsing},E)\\ &\times\pi(\text{comedy}\mid\text{page})\,p(\text{ended},1\mid\text{page},\text{comedy})\\ ={}&1\times1\times0.30\times0.50\times0.50=0.075. \end{aligned}\]

About 7.5% of visits follow this exact path. Plays after the action trailer follow another path.

Choose the policy with the highest expected return from the start

The return from time \(t\) is the discounted sum of future rewards: \[G_t=\sum_{k=0}^{T-t-1}\gamma^k R_{t+k+1},\qquad \pi^*\in\arg\max_\pi\mathbb E_{S_0\sim\rho_0,\,\pi,\,p}[G_0].\]

Which trailer policy earns more plays? With \(\gamma=1\), always showing comedy earns \(0.30(0.50)=0.15\) expected plays per visit. Mixing trailers equally earns \(0.30[0.5(0.50)+0.5(0.40)]=0.135\).

Discount sets the weight on later rewards. Bounded episodes can use \(\gamma=1\). For continuing tasks with bounded rewards, \(0\le\gamma<1\) guarantees a finite discounted sum.