提交 c6d5d8b7 编写于 作者: X xiaowei_xing

test

上级 1cc38dee
......@@ -415,4 +415,26 @@ $$
$$
= 0。
$$
\ No newline at end of file
$$
## 7.1 普通策略梯度(Vanilla Policy Gradient)
使用前面讨论的基准,这里我们介绍普通策略梯度(vanilla policy gradient)算法。假设基准函数的参数为 $\mathbf{w}$。
# 算法2
状态值函数是基准的一个很自然的选择,$b(s_t)=V(s_t)$,这时优势函数为 $A^{\pi}(s,a)=Q^{\pi}(s,a)-V^{\pi}(s)$。然而,由于我们不知道真实的状态值,因此我们使用估计值 $\hat{V}(s_t;\mathbf{w})$ 来代替,这里 $\mathbf{w}$ 为权重向量。我们可以通过蒙特卡洛轨迹采样来同时学习基准函数(状态值函数)的权重向量 $\mathbf{w}$ 和策略的参数 $\theta$。
注意,在算法 2 中,我们通常并不单独计算梯度 $\sum_t \hat{A}_ t \nabla_{\theta} \log \pi_{\theta}(a_t|s_t)$,而是将一个批的数据累积到损失函数中:
$$
L(\theta)=\sum_t \hat{A}_ t \log \pi_{\theta}(a_t|s_t),
$$
然后通过计算 $\nabla_{\theta} L(\theta)$ 来计算梯度。我们也可以在这个损失函数中引入一个分量来拟合基准函数:
$$
L(\theta,\mathbf{w})=\sum_t (\hat{A}_ t \log \pi_{\theta}(a_t|s_t) - \norm{b(s_t)-G_t^{(i)}}^2),
$$
然后我们可以计算 $L(\theta,\mathbf{w})$ 关于 $\theta$ 和 $\mathbf{w}$ 的梯度来执行 SGD 更新。
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册