1
$\begingroup$

Please see slide 78 in https://cs231n.stanford.edu/slides/2017/cs231n_2017_lecture14.pdf

$$\nabla_{\theta} J\left(\theta\right) \approx\sum_{t\ge 0}r(\tau) \nabla_{\theta} \log \pi_{\theta}\left(a_{t} \mid s_{t}\right)$$

Interpretation:

-If $r(\tau)$ is high, push up the probabilities of the actions seen.

-If $r(\tau)$ is low, push down the probabilities of the actions seen.

Question: It is not clear to me how this interpretation is done based on the mathematical expression. I will be happy for a detailed explanation.

$\endgroup$

1 Answer 1

-1
$\begingroup$

Bear in mind $\nabla_{\theta} J$ is used to update parameters $\theta$ in each step and $r(\tau)$ is the total reward of a sampling trajectory $\tau$ where we can rewrite the policy gradient equation as $$\nabla_{\theta} J(\theta) \approx r(\tau) \sum_{t\ge 0} \nabla_{\theta} \log \pi_{\theta}\left(a_{t} \mid s_{t}\right)$$ If $r(\tau)$ is positively great then the above policy gradient ascent algorithm intuitively intends to update the parameters in a direction so that each term $\log \pi_{\theta}\left(a_{t} \mid s_{t}\right)$ is pushed up. And since the $\log$ function is monotone, each term $\pi_{\theta}\left(a_{t} \mid s_{t}\right)$ is pushed up too which is nothing but exploitation viewed from the thesis of exploration vs exploitation of RL. This is why your reference claims it might seem simplistic to say that if a trajectory is good then all its actions were good.

If this cannot convince you, let's use a simple grid world example where an agent starts at the left corner and aims to reach a goal at the right corner. Suppose there are only two possible actions in any state $s$: $UP$ and $RIGHT$, and initial probabilities of taking these actions under the policy $\pi_{\theta}$ are $\pi_{\theta}(UP∣s)=0.5,\pi_{\theta}(RIGHT∣s)=0.5$. The reward $r(τ)$ for a trajectory $τ$ is $+10$ if it reaches the goal using the action $RIGHT$. For simplicity, let's say the softmax parameterization for actins in any state $s$ is: $π_θ(UP∣s)=\frac{e^{θ_1}}{e^{θ_1}+e^{θ_2}}, π_θ(RIGHT∣s)=\frac{e^{θ_2}}{e^{θ_1}+e^{θ_2}}$. Apparently, only by choosing action $RIGHT$ at each state $s$ the parameters $\theta$ will be pushed up in the direction of $θ_2$ per above policy gradient algorithm and thus $π_θ(RIGHT∣s)=\frac{e^{θ_2}}{e^{θ_1}+e^{θ_2}}$ is pushed up as well. ​

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .