Chapter 7 n-step Bootstrapping

核心思想就是在做bootstrapping之前再向前多走几步


7.1 n-step TD Prediction

The backup diagrams of n-step methods
temporal difference 扩展了n步,这就被称为n-step TD methods

n-step returns

Gt:t+nRt+1+γRt+2++γn1Rt+n+γnVt+n1(St+n) G t : t + n ≐ R t + 1 + γ R t + 2 + ⋯ + γ n − 1 R t + n + γ n V t + n − 1 ( S t + n )

其中 Vt:SR V t : S → R 这里是在t时刻对 vπ v π 的估计

因为又向后看了几步,所以只有等到得到 Rt+n R t + n 和计算出 Vt+n1 V t + n − 1 之后才能做更新

Vt+n(St)Vt+n1(St)+α[Gt:t+nVt+n1(St)],0tT V t + n ( S t ) ≐ V t + n − 1 ( S t ) + α [ G t : t + n − V t + n − 1 ( S t ) ] , 0 ≤ t ≤ T

n-step TD for estimating

error reduction property of n-step returns
the worst error of the expected n-step return is guaranteed to be less than or equal to γn γ n times the worst error under Vt+n1 V t + n − 1 :

maxs|Eπ[Gt:t+n|St=s]vπ(s)|γnmaxs|Vt+n1(s)vπ(s)| max s | E π [ G t : t + n | S t = s ] − v π ( s ) | ≤ γ n max s | V t + n − 1 ( s ) − v π ( s ) |

这表明所有的n-step TD方法在合适的技术条件下都收敛到正确的预测

7.2 n-step Sarsa

跟之前介绍的Sarsa相比,只有G变成了n-step returns

Gt:t+nRt+1+γRt+2++γn1Rt+n+γnQt+n1(Stn,At+n),n1,0t<Tn G t : t + n ≐ R t + 1 + γ R t + 2 + ⋯ + γ n − 1 R t + n + γ n Q t + n − 1 ( S t n , A t + n ) , n ≥ 1 , 0 ≤ t < T − n

更新公式也基本没有发生变化
Qt+n(St,At)Qt+n1(St,At)+α[Gt:t+nQt+n1(St,At)],0tT Q t + n ( S t , A t ) ≐ Q t + n − 1 ( S t , A t ) + α [ G t : t + n − Q t + n − 1 ( S t , A t ) ] , 0 ≤ t ≤ T

The backup diagrams for the spectrum of n-step methods for state-action values
n-step Sarsa for estimating

对于上图展示的Expected Sarsa。跟n-step Sarsa类似,除了最后考虑的一项不同。

Gt:t+nRt+1++γn1Rt+n+γnV¯t+n1(St+n),t+n<T, G t : t + n ≐ R t + 1 + ⋯ + γ n − 1 R t + n + γ n V ¯ t + n − 1 ( S t + n ) , t + n < T ,

这里的不同点有 Gt:t+nGt for t+nT G t : t + n ≐ G t  for  t + n ≥ T
其中 V¯t(s) V ¯ t ( s ) expected approximte value of state s
V¯t(s)aπ(a|s)Qt(s,a),for all sS V ¯ t ( s ) ≐ ∑ a π ( a | s ) Q t ( s , a ) , for all  s ∈ S

7.3 n-step On-policy Learning by Importance Sampling

这一节有关于off-policy learning很好的介绍。off-policy learning就是 学习一个policy π π 的值,同时遵循另外一个policy b的experience。通常, π π 是对当前action-value估计的greedy policy,而b是一个跟具有探索性的policy,或许是 ε-greedy ε -greedy

还是要用上 importance sampling ratio

ρt:hk=tmin(k,T1)π(Ak|Sk)b(Ak|Sk) ρ t : h ≐ ∏ k = t min ( k , T − 1 ) π ( A k | S k ) b ( A k | S k )

更新公式

Vt+n(St)Vt+n1(St)+αρt:t+n1[Gt:t+nVt+n1(St)],0t<T V t + n ( S t ) ≐ V t + n − 1 ( S t ) + α ρ t : t + n − 1 [ G t : t + n − V t + n − 1 ( S t ) ] , 0 ≤ t < T

off-policy form n-step Sarsa

Qt+n(St,At)Qt+n1(St,At)+αρt+1:t+n1[Gt:t+nQt+n1(St,At)],0t<T Q t + n ( S t , A t ) ≐ Q t + n − 1 ( S t , A t ) + α ρ t + 1 : t + n − 1 [ G t : t + n − Q t + n − 1 ( S t , A t ) ] , 0 ≤ t < T

off-policy n-step Sarsa

7.4 *Per-decision Off-policy Methods with Control Variates

A more sophisticated approach would use per-decision importance sampling ideas

n-step returns可以写为
Gt:h=Rt+1+γGt+1:h,t<h<T, G t : h = R t + 1 + γ G t + 1 : h , t < h < T ,

off-policy definition of the n-step return ending at horizon

Gt:hρt(Rt+1+γGt+1:h)+(1ρt)Vh1(St),t<h<T,(7.13) (7.13) G t : h ≐ ρ t ( R t + 1 + γ G t + 1 : h ) + ( 1 − ρ t ) V h − 1 ( S t ) , t < h < T ,

同时有 Gh:hVh1(Sh) G h : h ≐ V h − 1 ( S h )
上式7.13中的第二项被称为 control variate
control variate 不会改变期望更新,因为 在5.9节介绍过,importance sampling ratio的期望值是1。

An off-policy form with control variates

Gt:hRt+1+γ(ρt+1Gt+1:h+V¯h1(St+1)ρt+1Qh1(St+1,At+1)),=Rt+1+γρt+1(Gt+1:h+Qh1(St+1,At+1))+γV¯h1(St+1),t<hT. G t : h ≐ R t + 1 + γ ( ρ t + 1 G t + 1 : h + V ¯ h − 1 ( S t + 1 ) − ρ t + 1 Q h − 1 ( S t + 1 , A t + 1 ) ) , = R t + 1 + γ ρ t + 1 ( G t + 1 : h + Q h − 1 ( S t + 1 , A t + 1 ) ) + γ V ¯ h − 1 ( S t + 1 ) , t < h ≤ T .

如果 h<t h < t ,则递归以 Gh:hQh1(Sh,Ah) G h : h ≐ Q h − 1 ( S h , A h ) 结束;如果 hT h ≥ T ,则递归以 GT1:TRT G T − 1 : T ≐ R T 结束。

control variates就是一种减小方差的方法

7.5 Off-policy Learning Without Importance Sampling: The n-step Tree Backup Algorithm

不需要importance sampling的off-policy方法
tree-backup update

tree-backup n-step return的一般形式

Gt:t+nRt+t+γαAt+1π(a|St+1)Qt+n1(St+1,a)+γπ(At+1,St+1)Gt+1:t+n,t<T1 G t : t + n ≐ R t + t + γ ∑ α ≠ A t + 1 π ( a | S t + 1 ) Q t + n − 1 ( S t + 1 , a ) + γ π ( A t + 1 , S t + 1 ) G t + 1 : t + n , t < T − 1

当n=1时, GT1:TRT G T − 1 : T ≐ R T

上述action-value用于n-step Sarsa

Qt+n(St,At)Qt+n1(St,At)+α[Gt:tnQt+n1(St,At)],0t<T, Q t + n ( S t , A t ) ≐ Q t + n − 1 ( S t , A t ) + α [ G t : t n − Q t + n − 1 ( S t , A t ) ] , 0 ≤ t < T ,

n-step Tree Backup for estimating

7.6 *A Unifying Algorithm: n-step Q(δ) Q ( δ )

跟前面描述的类似,就是往前看的方式变了,其他的都是一样的,看下图
The backup diagrams

改写7.16的形式为如下:

Gt:h=Rt+1+γaAt+1π(a|St+1)Qh1(St+1,a)+γπ(At+1|St+1)Gt+1:h=Rt+1+γV¯h1(St+1)γπ(At+1|St+1)Qh1(St+1,At+1)+γπ(At+1|St+1)Gt+1:h=Rt+1+γπ(At+1|St+1)(Gt+1:hQh1(St+1,At+1))+γV¯h1(St+1) G t : h = R t + 1 + γ ∑ a ≠ A t + 1 π ( a | S t + 1 ) Q h − 1 ( S t + 1 , a ) + γ π ( A t + 1 | S t + 1 ) G t + 1 : h = R t + 1 + γ V ¯ h − 1 ( S t + 1 ) − γ π ( A t + 1 | S t + 1 ) Q h − 1 ( S t + 1 , A t + 1 ) + γ π ( A t + 1 | S t + 1 ) G t + 1 : h = R t + 1 + γ π ( A t + 1 | S t + 1 ) ( G t + 1 : h − Q h − 1 ( S t + 1 , A t + 1 ) ) + γ V ¯ h − 1 ( S t + 1 ) ,

把其中的 π(At+1|St+1) π ( A t + 1 | S t + 1 ) 替换成importance-sampling ratio ρt+1 ρ t + 1
Gt:hRt+1+γ(δt+1ρt+1+(1δt+1)π(At+1|St+1))(Gt+1:hQh1(St+1,At+1))+γV¯h1(St+1) G t : h ≐ R t + 1 + γ ( δ t + 1 ρ t + 1 + ( 1 − δ t + 1 ) π ( A t + 1 | S t + 1 ) ) ( G t + 1 : h − Q h − 1 ( S t + 1 , A t + 1 ) ) + γ V ¯ h − 1 ( S t + 1 )

对于 t<hT t < h ≤ T ,如果 h<T h < T ,则递归式最后以 Gh:h0 G h : h ≐ 0 结束;如果 h=T h = T ,则递归式最后以 GT1:TRT G T − 1 : T ≐ R T 结束。

Off-policy n-step Q(delta)

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值