Appendix A. The Gradient of a Logistic Policy for Two Actions
Equation 5-6 is a policy for two actions. To update the policies I need to calculate the gradient of the natural logarithm of the policy (see Equation 5-4). I present this in Equation A-1. You can perform the differentiation in a few different ways depending on how you refactor it, so the result can look different, even though it provides the same result.
Equation A-1. Logistic policy gradient for two actions
I calculate the gradients of each action independently and I find it easier if I refactor the logistic function like in Equation A-2.
Equation A-2. Refactoring the logistic function
The derivative of the refactored logistic function, for action 0, is shown in Equation A-3.
Equation A-3. Differentiation of action 0
The method to calculate the derivative of the policy for action 1 is shown in Equation A-4. Note that the derivation towards the end is the same as Equation A-3.
Equation A-4. Differentiation of action 1
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access