CS285 2023Fall HW1作业解析

CS285 2023Fall HW1

前言

你好! 这是你第一次使用 Markdown编辑器 所展示的欢迎页。如果你想学习如何使用Markdown编辑器, 可以仔细阅读这篇文章,了解一下Markdown的基本语法知识。

Analysis

Q1.

在这里插入图片描述

分析:给出的条件实际上是Lecture2里提到的General Analysis的弱化版本,在Lecture中,实际上规定了在每一个时间步t,对当前时间步任意状态 s t s_t st都有 π θ ( a t ≠ π ∗ ( s t ) ∣ s t ) ≤ ϵ \pi_\theta(a_t\neq \pi^*(s_t)|s_t)\leq\epsilon πθ(at=π(st)st)ϵ,而在这个问题中,该条件若化为了对任意时间步、任意状态的期望,这实际上是两个期望,一个是对时间的期望,另一个是对每个时间下状态的期望。根据下面的Hint,提示我们大概要构造期望,并用到一个和概率有关的union bound不等式,下面我们来求解。

首先我们模仿Lecture的内容,对于一个时间步骤 t t t,我们任取一个状态 s t s_t st,为了方便后面的书写,我们先定义一个概率,即截至t时间步内,策略 π θ \pi_\theta πθ与最优策略完全相同的概率:
p c o r r e c t = ( 1 − P r ( ⋃ t = 1 t π θ ( a t ) ≠ π ∗ ( a t ) ) ) (1) p_{correct}=(1-Pr(\bigcup_{t=1}^t\pi_\theta(a_t)\neq\pi^* (a_t)))\tag{1} pcorrect=(1Pr(t=1tπθ(at)=π(at)))(1)
从而得到以下概率表示,这实际上是Lecture的公式的变形。
p π θ ( s t ) = p c o r r e c t p π ∗ ( s t ) + ( 1 − p c o r r e c t ) p w r o n g ( s t ) (2) p_{\pi_\theta}(s_t)=p_{correct}p_{\pi^*}(s_t) + (1-p_{correct})p_{wrong}(s_t)\tag{2} pπθ(st)=pcorrectpπ(st)+(1pcorrect)pwrong(st)(2)
因此,采用与Lecture中相同的方式,我们可以得到:
∣ p π θ ( s t ) − p π ∗ ( s t ) ∣ = ( 1 − p c o r r e c t ) ∣ p w r o n g ( s t ) − p π ∗ ( s t ) ∣ (3) |p_{\pi_\theta}(s_t)-p_{\pi^*}(s_t)|=(1-p_{correct})|p_{wrong}(s_t)-p_{\pi^*}(s_t)|\tag{3} pπθ(st)pπ(st)=(1pcorrect)pwrong(st)pπ(st)(3)
这里我们就已经得到了一个初步的表达式了,根据绝对值的性质,证明里的2已经凑出来了,这里我们先尝试分析 p c o r r e c t p_{correct} pcorrect
p c o r r e c t ≥ 1 − ∑ t = 1 t P r ( π θ ( a t ) ≠ π ∗ ( a t ) ) = 1 − ∑ t = 1 t π θ ( a t ≠ π ∗ ( s ) ∣ s ) (4) p_{correct}\geq1-\sum_{t=1}^tPr(\pi_\theta(a_t)\neq\pi^* (a_t))=1-\sum_{t=1}^t\pi_\theta(a_t\neq\pi^*(s)|s)\tag{4} pcorrect1t=1tPr(πθ(at)=π(at))=1t=1tπθ(at=π(s)s)(4)
从而我们就得到:
∣ p π θ ( s t ) − p π ∗ ( s t ) ∣ ≤ ( ∑ t = 1 t π θ ( a t ≠ π ∗ ( s ) ∣ s ) ) ∣ p w r o n g ( s t ) − p π ∗ ( s t ) ∣ (5) |p_{\pi_\theta}(s_t)-p_{\pi^*}(s_t)|\leq(\sum_{t=1}^t\pi_\theta(a_t\neq\pi^*(s)|s))|p_{wrong}(s_t)-p_{\pi^*}(s_t)|\tag{5} pπθ(st)pπ(st)(t=1tπθ(at=π(s)s))pwrong(st)pπ(st)(5)
这里实际上就已经化简完了,最后直接套用前面的公式即可。但是我还是想问一个问题,这个问题当时看Lecture没有发现,即,我们能证明:
∣ p π θ ( s t ) − p π ∗ ( s t ) ∣ ≤ 2 ϵ T |p_{\pi_\theta}(s_t)-p_{\pi^*}(s_t)|\leq2\epsilon T pπθ(st)pπ(st)2ϵT但是我们怎么证明:
∑ s t ∣ p π θ ( s t ) − p π ∗ ( s t ) ∣ ≤ 2 ϵ T (6) \sum_{s_t}|p_{\pi_\theta}(s_t)-p_{\pi^*}(s_t)|\leq2\epsilon T\tag{6} stpπθ(st)pπ(st)2ϵT(6)
这里很奇怪的一点是,课件上的证明是直接用了这一点?很莫名其妙。
在这里插入图片描述

Q2.

在这里插入图片描述
(1)如果reward只取决于 s t s_t st,则可以化简为:
J ( π ) = ∑ i = 1 T E p π ( s t ) r ( s t ) = E p π ( s T ) r ( s T ) J(\pi)=\sum_{i=1}^TE_{p_{\pi(s_t)}}r(s_t)=E_{p_{\pi(s_T)} }r(s_T) J(π)=i=1TEpπ(st)r(st)=Epπ(sT)r(sT)
因此,有:
J ( π ∗ ) − J ( π θ ) = E p π ∗ ( s T ) r ( s T ) − E p π θ ( s T ) r ( s T ) ≤ 2 ϵ T R m a x = O ( T ϵ ) J(\pi^*)-J(\pi_\theta)=E_{p_{\pi^*(s_T)} }r(s_T)-E_{p_{\pi_\theta(s_T)} }r(s_T)\leq2\epsilon TR_{max}=\mathcal{O}(T\epsilon) J(π)J(πθ)=Epπ(sT)r(sT)Epπθ(sT)r(sT)2ϵTRmax=O(Tϵ)
(2)同理,因为有求和,所以是 O ( T 2 ϵ ) \mathcal{O}(T^2\epsilon) O(T2ϵ)

Code

待更新

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值