The multi-arm bandit problem (MAB) models a casino with k machines, where the reward of each machine is controlled by a fixed and unknown distribution. The player (agent) observes independent random rewards from generated from the distribution of a machine each time it pulls its arm. Because of limited budget, the player can only play the machines T times. The goal of the player is to maximize its expected gain.
There is an inherent exploration-exploitation nature of the problem.
The player has to explore what is a good machine while simultaneously exploits what seems to be a good machine.
Formulation
We study the restricted case where the reward distribution of each machine is bounded on [0,1]. Define
Di: the reward distribution on [0,1] of the i-th machine, where i∈[k],
μi: the expected reward of the i-th machine, where i∈[k],
μ∗=maxi∈[k]μi,
i∗: the index of the machine with highest expected reward,
Δi=μ∗−μi.
Let Yi be the random reward vector whose elements are i.i.d. random variables from Di:
Yi=(Yi,1,Yi,2,...,Yi,T)
Denote Y be the matrix of the random variables
Y=Y1Y2...Yk
Each time the player pulls the arm, it observes one random variable from the matrix. Specially, let
It: the machine played at the t-th trial,
Ni(t): the number of times the machine i is played up to trial t.
Before trial t, the number of random variables observed in YIt is NIt(t−1). At trial t, a new random variable in YIt is observed, and NIt(t)=NIt(t−1)+1. Hence, the newly observed random variable is YIt,NIt(t). For convenience, we define
Xt≐YIt,NIt(t): the rewards obtained at the t-th trial.
When the player chooses a machine It on trial t, it is based on the history of his play, which consists of his past decisions, and the corresponding observed rewards:
Ht:{(I1,X1),(I2,X2),...,(It−1,Xt−1)} the history up to trial t.
The strategy the player uses at trial t is considered as a functions from Ht to [k]:
ϕt:Ht→[k] a function that chooses a machine based on the history at trial t
We define the policy as the strategies the player uses over all trials:
ϕ=(ϕ1,ϕ2,...,ϕT): policy, the strategy for the pulling arms by the player
The goal is to find a policy that maximizes the expected rewards, or equivalently, the one that minimizes the expected regret
R(ϕ)=T⋅μ∗−E[t=1∑TXt]
By definition of Ni(t)'s, we have ∑i=1kNi(T)=T. Then the regret can be written as
When making decision at trial t, a good indicator of a machine's performance is its empirical reward:
μ^i,Ni(t−1)≐τ=1∑Ni(t−1)Ni(t−1)1Yi,τ
But this might not reflect the true value of its expectation μi because of sampling variation. The UCB algorithm takes the variation into consideration.
Fact.Hoeffding Inequality.Let Z1,Z2,...,Zs be i.i.d. copies of random variable Z on [a,b]. Then
Pr[s1τ=1∑sZτ−E[Z]≥r]≤exp(−(b−a)22sr2)
where r > 0.
Now, consider a fixeds (1≤s≤T) and a failure probability δ>0. Applying Hoeffding inequality with Z1=Yi,1,Z2=Yi,2,...,Zs=Yi,s, a=0,b=1 and r=2slogδ1, we get
Pr[μ^i,s−μi≥2slogδ1]≤δ
Similarly, by applying Hoeffding inequality with Z1=−Yi,1,Z2=−Yi,2,...,Zs=−Yi,s, a=−1,b=0 and r=2slogδ1, we have
Pr[μi−μ^i,s≥2slogδ1]≤δ
Inspired by this, the UCB defines the upper and lower bounds for the expected reward of the i-th machine as follows:
where α>0 is a parameter to be set. By convention here that if Ni(t−1)=0, 2Ni(t−1)logtα=∞.
The UCB algorithms chooses just the machine with highest upper bound. The lower bound is needed for its analysis.
UCB algorithm
For t←1 to T do
Choose It=argmaxi∈[k]UBi(t)
Observe a reward Xt
Intuitively, there are two cases when UBi(t) is high:
The value μi is high;
The i-th machine is under-explored.
Caveat:The reader might start to think that at trial t, it holds that Pr[μi≥UBi(t)] (or Pr[μi≤LBi(t)]) is bounded by tα1, according to Hoeffding inequality. It is not. Hoeffding inequality requires the number of samples to be a fixed number. On the other hand, Ni(t−1) is a random variable that depends on the history of the game. We will discuss this later.
The following theorem states that the expected regret of UCB algorithm grows logarithmically with T.
Theorem.If α>2, the regret of the UCB algorithm is bounded by
R(ϕ)≤logT⋅(i:Δi>0∑Δi2α)+α−2αi:Δi>0∑Δi
Proof:
We will show that for i:Δi>0,
E[ni,T]≤Δi2αlogT+α−2α
The key for the proof relies on a sufficient condition that the i-th machine will not be chosen at trial t:
if the following events happen at trial t, machine i will not be chosen:
At:22Ni(t−1)αlogt≤Δi
Bt:UBi∗(t)>μ∗
Ct:μi>LBi(t)
This condition essentially prevents UBi(t) from exceeding μ∗ while assures UBi∗(t) is higher than μ∗.
When we know ni∗,t=τ for some τ, the ni∗,t rewards from machine i∗ can't be viewed as independent samples. E.g., if t is large, the best machines has much larger expected reward than others, and ni∗,t is very small compared to t. Then it is likely machine i∗ generates bad rewards in the history. The reward sequence of i∗ can't be viewed as a sequence of independent samples from distribution Di∗.
■
Reference
[1] D. Katselis, B. Miranda, and H. Hu, “Lecture 8: Multi-Armed Bandits”, ECE586 MDPs and Reinforcement Learning, Spring 2019, University of Illinois at Urbana-Champaign.
[2] S. Bubeck and N. Cesa-Bianchi, “Regret Analysis of Stochastic and Nonstochastic Multi-armed Bandit Problems,” arXiv:1204.5721 [cs, stat], Nov. 2012, Accessed: Oct. 19, 2020.