Chapter 2 Multi-armed Bandits

本文为看《reinforcement learning :an introduction》时的笔记总结


标题解释为:多臂老虎机

因为我最开始看的时候不知道这个名词的意思


这一章基本上把后面要讲到的所有方法都简介了一遍,初步了解这些方法对理解后面的内容很有帮助


1. A k-armed Bandit

该问题指老虎机,有k个臂,对应k个不同的options或actions。在每次选择之后,你会收到一个数值奖励,该数值奖励取决于你选择的行动的stationary probability distribution

expected reward given that a is selected

q(a)E[Rt|At=a]

其中At表示t时刻被选中的action

We denote the estimated value of action a at time step t as Qt(a). We would like Qt(a) to be close to q(a).

在t时刻总是有一个estimated value最大的action,贪心的选择这个动作被称为exploiting,而选择nongreedy actions则被称为exploring,平衡这两种选择的是个问题

2. Action-value Methods

一种很自然的方法是平均化所实际收到的奖励

Qt(a)sum of rewards when a taken prior to tnumber of times a taken prior to t=i=1t1Ri1Ai=ai=1t11Ai=a

其中1predicate表示随机变量是1,如果predicate为true,否则为0

这里根据大数定理Q(a)是收敛到q(a)

greedy action selection method 则可以写为

AtargmaxQt(a)a

因为greedy 方法总是exploit,不会去explore,所以可以用 ε-greedy 方法。

大多数时候(概率1ε)正常greedy选择;只是偶尔(以概率ε)从所有actions中等概率的选择action,与action-value estimates独立

3. The 10-armed Testbed

用一个实例来说明 ε-greedy 方法比 greedy 方法要好

Chapter 2 Multi-armed Bandits

Chapter 2 Multi-armed Bandits

4. Incremental Implementation

我们迄今为止所讨论的action-value methods都将action-values估计为观察到的rewards的样本平均值。

考虑增量的计算这些averages,这样更高效,而且每一步的内存和计算都是固定的

QnR1+R2++Rn1n1

Ri now denote the reward received after the ith selection of this action

Qn denote the estimate of its action value after it has been selected n-1 times

则有

Qn+1=1ni=1nRi=1n(Rn+i=1n1Ri)=1n(Rn+(n1)1n1i=1n1Ri)=1n(Rn+(n1)Qn)=1n(Rn+nQnQn)=Qn+1n[RnQn]

对于n=1,有 Q2=R1

上述更新公式的一般形式将会一直出现在后面的文章中

NewEstimateOldEstimate+StepSize [TargetOldEstimate]

Chapter 2 Multi-armed Bandits

5. Tracking a Nonstationary Problem

averaging methods到目前为止对于stationary bandit problems是合适的,因为对bandit problems,reward probabilities不随时间变化

但是很多强化学习问题是nonstaionary的,在这种情况下,给最近的reward更大的权重更有意义。这种做法最流行的方法之一是使用恒定的step-size参数

这里average Qn 被修改为: Qn+1Qn+α[RnQn] ,其中 α(0,1] ,而且是常数。

This results in Qn+1 being a weighted average of past rewards and the initial estimate Q1:

Qn+1=Qn+α[RnQn]=αRn+(1α)Qn=αRn+(1α)[αRn1+(1α)Qn1]=αRn+(1α)αRn1+(1α)2Qn1=αRn+(1α)αRn1+(1α)2Rn2++(1α)n1αR1+(1α)nQ1=(1α)nQ1+i=1nα(1α)niRi

有时,逐步改变步长参数是很方便的。但是不是所有的 αn(a) 都保证收敛。

然而随机逼近理论中众所周知的结果为我们提供了确保以概率 1 收敛的条件:

n1αn(a)=andn=1αn2(a)<

6. Optimistic Initial Values

到目前为止,我们所讨论的所有方法在一定程度上取决于初始行动价值估计 Q1(a)。用统计学的语言来说,这些方法偏向于他们的初步估计
但这并不普遍

7. Upper-Confidence-Bound(UCB) Action Selection

因为采用 ε-greedy 方法,所以

根据其实际最佳的潜力,在非贪婪行为中进行选择会更好一些,同时考虑到它们的估计有多接近最大值以及这些估计值的不确定性

One effective way of doing this is to select actions according to:\
At=argmaxα[Qt(a)+clntNt(a)]

  • Nt(a) denotes the number of times that action a has been selected prior to time t
  • the number c > 0 controls the degree of exploration


UCB常用在蒙特卡洛搜索树中

8. Gradient Bandit Algorithms

到目前为止,前面讲到的方法都是使用estimates来选择actions。这通常是一个好方法,但它不是唯一可能的方法。

这里考虑action a的numerical preference Ht(a)

相对preference才是要考虑的,这里根据soft-max distribution来考虑,根据更大的相对preference选择action

Pr(At=a)eHt(a)b=1keHt(a)πt(a)

这里的 πt(a) 就是后面常说的policy,在时刻t选择动作a的概率

学习算法为

Ht+1(At)Ht(At)+α(RtRt¯)(1πt(At)), andHt+1(At)Ht(At)+α(RtRt¯)πt(a)for all aAt

这里 α>0 是学习率

证明看书吧 Reinforcement Learning:An Introduction