2020-11-03 强化学习笔记

强化学习第二章

什么是Multi-Armed Bandit

这事一种经典的问题可以很好的证明 exploration vs exploitation的难题。假如你有一台老虎机,它的奖励分布你是未知,这个问题就是What is the best strategy to achieve highest long-term rewards?

为了下面的讲述,我们引用定义
在这里插入图片描述
常用的策略有:

  • No exploration: the most naive approach and a bad one.
  • Exploration at random
  • Exploration smartly with preference to uncertainty

ϵ − G r e e d y 定 理 \epsilon-Greedy 定理 ϵGreedy

这种方式大部分的选择都是最优的,但是会时不时的进行随机exploration,进行的概率为 ϵ \epsilon ϵ

Q ^ t ( a ) = 1 N t ( a ) ∑ τ = 1 t r τ 1 [ a τ = a ] \hat{Q}_{t}(a)=\frac{1}{N_{t}(a)} \sum_{\tau=1}^{t} r_{\tau} 1\left[a_{\tau}=a\right] Q^t(a)=Nt(a)1τ=1trτ1[aτ=a]

Upper-Confidebce-Bound Action Selection

这种方式更加偏向exploration,补充了 ϵ − g r e e d y \epsilon-greedy ϵgreedy方法没有对那些需要explorate的action进行explorate,也就是很随机地进行greedy搜索。
公式如下
A t ≐ arg ⁡ max ⁡ a [ Q t ( a ) + c ln ⁡ t N t ( a ) ] A_{t} \doteq \underset{a}{\arg \max }\left[Q_{t}(a)+c \sqrt{\frac{\ln t}{N_{t}(a)}}\right] Ataargmax[Qt(a)+cNt(a)lnt ]
也就是说,通过 c ln ⁡ t N t ( a ) c \sqrt{\frac{\ln t}{N_{t}(a)}} cNt(a)lnt ,即 U ^ \hat{U} U^,从而来获取那些certainty较小的,注意 N t N_t Nt越大,certainty越大。

Gradient Bandit Algorithms

之前都提出了很多方法去估计action value并且利用这些估计去选择actions,这里重新对actions的选择提出一种新的preference。这种方式跟rreward无关,只有一个动作相对于另一个动作的preference才是重要的,也就是说是相对而言,并不是preference越大越好,必须相对的去比较。

Pr ⁡ { A t = a } ≐ e H t ( a ) ∑ b = 1 k e H t ( b ) ≐ π t ( a ) \operatorname{Pr}\left\{A_{t}=a\right\} \doteq \frac{e^{H_{t}(a)}}{\sum_{b=1}^{k} e^{H_{t}(b)}} \doteq \pi_{t}(a) Pr{At=a}b=1keHt(b)eHt(a)πt(a)
π t ( a ) \pi_t(a) πt(a)是在时间t处的一种概率分布,在 t = 0 t=0 t=0时,所有的 H i ( a ) = 0 H_i(a)=0 Hi(a)=0,这样的话所有的actions都有一个相同被选中的概率分布
在每一步,preference通过下面的公式被更新
H t + 1 ( A t ) ≐ H t ( A t ) + α ( R t − R ˉ t ) ( 1 − π t ( A t ) ) ,  and  H t + 1 ( a ) ≐ H t ( a ) − α ( R t − R ˉ t ) π t ( a ) ,  for all  a ≠ A t \begin{aligned} H_{t+1}\left(A_{t}\right) & \doteq H_{t}\left(A_{t}\right)+\alpha\left(R_{t}-\bar{R}_{t}\right)\left(1-\pi_{t}\left(A_{t}\right)\right), & & \text { and } \\ H_{t+1}(a) & \doteq H_{t}(a)-\alpha\left(R_{t}-\bar{R}_{t}\right) \pi_{t}(a), & & \text { for all } a \neq A_{t} \end{aligned} Ht+1(At)Ht+1(a)Ht(At)+α(RtRˉt)(1πt(At)),Ht(a)α(RtRˉt)πt(a), and  for all a=At
公式中的参数如下解释
在这里插入图片描述

Associative Search

目标是学习一种策略,能够从各种situation映射到相应的action中,并且这种action能带来最好的reward。这种方式通过强化学习任务中提供可利用的信息,去辨别action。就如书上的例子一样,假如当action value改变时,老虎机的颜色也在变化,这样就可以通过颜色去选择相应的action

代码: github实现

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值