2
$\begingroup$

Currently learning about the policy gradient theorem for reinforcement learning. The final derivation for the policy gradient simplifies to $$E_{\pi}[Q^{\pi}(s,a)\nabla_{\theta}ln\,\pi_{\theta}(a|s)]$$ where $E_{\pi}$ is equivalent to $E_{s \sim d^{\pi},a \sim \pi_{\theta}}$. Sampling $a \sim \pi$ is straightforward. My question is how do we sample from the stationary state distribution $s \sim d^{\pi}$ for the current policy $\pi_{\theta}$ ?

$\endgroup$
0

1 Answer 1

2
$\begingroup$

If you just do a "roll out" (technical terminology meaning that you just play the game / run the MDP forward) according to your policy $\pi_\theta$ for long enough, you'll be sampling states from $d^\pi$. There are some mild technical conditions, but basically you'll always converge to the stationary distribution after enough time.

However, usually people play games of finite episode length, and in that case there's a finite horizon policy gradients which is almost exactly the same thing but instead of sampling from $d^\pi$, people just sample over the distribution of states from rollouts of finite length. And you can sample from that distribution the same way -- just play the game a bunch of times.

$\endgroup$
3
  • $\begingroup$ Ah right.. I came across two derivations of policy gradients. One makes use of stationary distribution while the other does not. It seems that the derivation using stationary distribution is for the infinite horizon case ? $\endgroup$
    – calveeen
    Commented Nov 3, 2020 at 1:35
  • $\begingroup$ that's my understanding $\endgroup$
    – shimao
    Commented Nov 3, 2020 at 1:38
  • $\begingroup$ It looks like the transition probability and the stochastic policy are assumed to be time-homogeneous en.wikipedia.org/wiki/Markov_chain#Types_of_Markov_chains. Is it necessary to prove the policy gradient theorem? Here is a detailed derivation with time-homogeneity to help with the discussion. $\endgroup$
    – Hans
    Commented Sep 12, 2021 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.