DRL — Policy Based Methods — Chapter 3-4 Proximal Policy Optimization

DRL — Policy Based Methods — Chapter 3-4 Proximal Policy Optimization

3.4.3 Beyond REINFORCE

  1. REINFORCE works as follows: First, we initialize a random policy π θ ( a ; s ) \pi_\theta(a;s) πθ(a;s), and using the policy we collect a trajectory – or a list of (state, actions, rewards) at each time step:

s 1 , a 1 , r 1 , s 2 , a 2 , r 2 , . . . s_1, a_1, r_1, s_2, a_2, r_2, ... s1,a1,r1,s2,a2,r2,...

  1. Second, we compute the total reward of the trajectory R = r 1 + r 2 + r 3 + . . . R=r_1+r_2+r_3+... R=r1+r2+r3+..., and compute an estimate the gradient of the expected reward, g g g:

g = R ∑ t ∇ θ log ⁡ π θ ( a t ∣ s t ) g = R \sum_t \nabla_\theta \log\pi_\theta(a_t|s_t) g=Rtθlogπθ(atst)

  1. Third, we update our policy using gradient ascent with learning rate α \alpha α:

θ ← θ + α \theta \leftarrow \theta + \alpha θθ+α

  1. The process then repeats.

What are the main problems of REINFORCE? There are three issues:

  • The update process is very inefficient! We run the policy once, update once, and then throw away the trajectory.

  • The gradient estimate gg is very noisy. By chance the collected trajectory may not be representative of the policy.

  • There is no clear credit assignment. A trajectory may contain many good/bad actions and whether these actions are reinforced depends only on the final total output.

In the following concepts, we will go over ways to improve the REINFORCE algorithm and resolve all 3 issues. All of the improvements will be utilized and implemented in the PPO algorithm.

3.4.4 Noise Reduction

3.4.6 Policy Gradient Quiz

Make sure you are using the fact that π θ ( 1 ∣ s t ) = θ \pi_\theta(1|s_t) = \theta πθ(1st)=θ, and π θ ( 0 ∣ s t ) = 1 − θ \pi_{\theta}(0|s_t) = 1-\theta πθ(0st)=1θ. Also remember that
∑ t ∇ θ log ⁡ π θ ( a t ∣ s t ) R t f u t u r e = ∑ t ∇ θ π θ ( a t ∣ s t ) π θ ( a t ∣ s t ) R t f u t u r e \sum_t \nabla_{\theta} \log\pi_{\theta}(a_t | s_t) R_{t}^{\rm future} = \sum_t \frac{\nabla_{\theta} \pi_{\theta}(a_t | s_t)}{\pi_{\theta}(a_t | s_t)} R_{t}^{\rm future} tθlogπθ(atst)Rtfuture=tπθ(atst)θπθ(atst)Rtfuture

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值