Understanding policy gradient theorem - What does it mean to take gradients of reward wrt policy parameters? The Next CEO of Stack Overflow2019 Community Moderator ElectionSemi-gradient TD(0) Choosing an ActionDoes employment of engineered immediate rewards in RL introduce a non-linear problem to an agent?How does action get selected in a Policy Gradient Method?Potential-based reward shaping in DQN reinforcement learningPolicy Gradient Methods - ScoreFunction & Log(policy)Dueling DQN - why should we decompose and then combine them back into?Policy Gradients - gradient Log probabilities favor less likely actions?RL's policy gradient (REINFORCE) pipeline clarificationReinforcement learning for continuous state and action space

If the heap is initialized for security, then why is the stack uninitialized?

Can a single photon have an energy density?

Anatomically Correct Strange Women In Ponds Distributing Swords

How can I quit an app using Terminal?

WOW air has ceased operation, can I get my tickets refunded?

How can I open an app using Terminal?

Robert Sheckley short story about vacation spots being overwhelmed

How to start emacs in "nothing" mode (`fundamental-mode`)

How do I solve this limit?

Customer Requests (Sometimes) Drive Me Bonkers!

Why were Madagascar and New Zealand discovered so late?

How to write the block matrix in LaTex?

Go Pregnant or Go Home

Unreliable Magic - Is it worth it?

Anatomically Correct Mesopelagic Aves

How to make a software documentation "officially" citable?

How should I support this large drywall patch?

What is the point of a new vote on May's deal when the indicative votes suggest she will not win?

How do scammers retract money, while you can’t?

How to use tikz in fbox?

How did people program for Consoles with multiple CPUs?

Should I tutor a student who I know has cheated on their homework?

Why did we only see the N-1 starfighters in one film?

Which organization defines CJK Unified Ideographs?



Understanding policy gradient theorem - What does it mean to take gradients of reward wrt policy parameters?



The Next CEO of Stack Overflow
2019 Community Moderator ElectionSemi-gradient TD(0) Choosing an ActionDoes employment of engineered immediate rewards in RL introduce a non-linear problem to an agent?How does action get selected in a Policy Gradient Method?Potential-based reward shaping in DQN reinforcement learningPolicy Gradient Methods - ScoreFunction & Log(policy)Dueling DQN - why should we decompose and then combine them back into?Policy Gradients - gradient Log probabilities favor less likely actions?RL's policy gradient (REINFORCE) pipeline clarificationReinforcement learning for continuous state and action space










0












$begingroup$


I am looking for a little clarity on what the policy gradient theorem means. My confusion lies in the fact that the reward $R$ in reinforcement learning is non-differentiable in the policy parameters. As that is the case how does the central objective of policy gradients, finding the gradients of Reward $R$ wrt the parameters of policy function even make sense?










share|improve this question









$endgroup$




bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.



















    0












    $begingroup$


    I am looking for a little clarity on what the policy gradient theorem means. My confusion lies in the fact that the reward $R$ in reinforcement learning is non-differentiable in the policy parameters. As that is the case how does the central objective of policy gradients, finding the gradients of Reward $R$ wrt the parameters of policy function even make sense?










    share|improve this question









    $endgroup$




    bumped to the homepage by Community 6 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      0












      0








      0





      $begingroup$


      I am looking for a little clarity on what the policy gradient theorem means. My confusion lies in the fact that the reward $R$ in reinforcement learning is non-differentiable in the policy parameters. As that is the case how does the central objective of policy gradients, finding the gradients of Reward $R$ wrt the parameters of policy function even make sense?










      share|improve this question









      $endgroup$




      I am looking for a little clarity on what the policy gradient theorem means. My confusion lies in the fact that the reward $R$ in reinforcement learning is non-differentiable in the policy parameters. As that is the case how does the central objective of policy gradients, finding the gradients of Reward $R$ wrt the parameters of policy function even make sense?







      machine-learning reinforcement-learning policy-gradients






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 26 at 14:52









      MiloMinderbinderMiloMinderbinder

      280110




      280110





      bumped to the homepage by Community 6 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 6 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          We want to find the gradient of policy "return" $V$ wrt. parameters of the policy $theta$. Where the return $V$ could be written as "how good is an action $Q$ $times$ probability of taking that action $pi$".



          Consider the policy gradient, $nabla_theta V = sum_a Q nabla_theta pi + pi nabla_theta Q$



          The first term tells us to adjust the action probability proportionally to how good it is. To me it could read "if an action yields good, take more". That is to move the peak of $pi$ to match the peak of $Q$. This is a reasonable thing to do. But of course since $Q$ cannot directly guide us toward its peak, it is up to our $pi$ to luckily stumble upon the high peak of $Q$. This emphasizes the importance of exploratory nature of $pi$.



          The second term is vice versa. That is to move the peak of $Q$ to match the peak of $pi$. This is much harder a task because $Q$ is a function of both action and policy, $Q_pi_theta(s, a)$. We clearly don't have this in a differentiable form i.e. we don't have a universal $Q$ function over the space of all possible $pi$.



          We now have a partial gradient from the first term but we have yet to estimate the second term.



          Turns out, the second term can be recursively written solely in the form of the first term but with subsequent actions and states.



          $$
          nabla_theta V_0 = sum Q_0 nabla_theta pi_0 + sum Q_1 nabla_theta pi_1 + sum Q_2 nabla_theta pi_2 + dots
          $$



          That is to get good policy i.e. policy gradient we only need to move the peaks of $pi$ to match the peaks of $Q$ not only the first (state, action) but also for all subsequent (state, action)'s. This yields the same result as if we differentiate through the $Q$.






          share|improve this answer









          $endgroup$













            Your Answer





            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("mathjaxEditing", function ()
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            );
            );
            , "mathjax-editing");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "557"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f46266%2funderstanding-policy-gradient-theorem-what-does-it-mean-to-take-gradients-of-r%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0












            $begingroup$

            We want to find the gradient of policy "return" $V$ wrt. parameters of the policy $theta$. Where the return $V$ could be written as "how good is an action $Q$ $times$ probability of taking that action $pi$".



            Consider the policy gradient, $nabla_theta V = sum_a Q nabla_theta pi + pi nabla_theta Q$



            The first term tells us to adjust the action probability proportionally to how good it is. To me it could read "if an action yields good, take more". That is to move the peak of $pi$ to match the peak of $Q$. This is a reasonable thing to do. But of course since $Q$ cannot directly guide us toward its peak, it is up to our $pi$ to luckily stumble upon the high peak of $Q$. This emphasizes the importance of exploratory nature of $pi$.



            The second term is vice versa. That is to move the peak of $Q$ to match the peak of $pi$. This is much harder a task because $Q$ is a function of both action and policy, $Q_pi_theta(s, a)$. We clearly don't have this in a differentiable form i.e. we don't have a universal $Q$ function over the space of all possible $pi$.



            We now have a partial gradient from the first term but we have yet to estimate the second term.



            Turns out, the second term can be recursively written solely in the form of the first term but with subsequent actions and states.



            $$
            nabla_theta V_0 = sum Q_0 nabla_theta pi_0 + sum Q_1 nabla_theta pi_1 + sum Q_2 nabla_theta pi_2 + dots
            $$



            That is to get good policy i.e. policy gradient we only need to move the peaks of $pi$ to match the peaks of $Q$ not only the first (state, action) but also for all subsequent (state, action)'s. This yields the same result as if we differentiate through the $Q$.






            share|improve this answer









            $endgroup$

















              0












              $begingroup$

              We want to find the gradient of policy "return" $V$ wrt. parameters of the policy $theta$. Where the return $V$ could be written as "how good is an action $Q$ $times$ probability of taking that action $pi$".



              Consider the policy gradient, $nabla_theta V = sum_a Q nabla_theta pi + pi nabla_theta Q$



              The first term tells us to adjust the action probability proportionally to how good it is. To me it could read "if an action yields good, take more". That is to move the peak of $pi$ to match the peak of $Q$. This is a reasonable thing to do. But of course since $Q$ cannot directly guide us toward its peak, it is up to our $pi$ to luckily stumble upon the high peak of $Q$. This emphasizes the importance of exploratory nature of $pi$.



              The second term is vice versa. That is to move the peak of $Q$ to match the peak of $pi$. This is much harder a task because $Q$ is a function of both action and policy, $Q_pi_theta(s, a)$. We clearly don't have this in a differentiable form i.e. we don't have a universal $Q$ function over the space of all possible $pi$.



              We now have a partial gradient from the first term but we have yet to estimate the second term.



              Turns out, the second term can be recursively written solely in the form of the first term but with subsequent actions and states.



              $$
              nabla_theta V_0 = sum Q_0 nabla_theta pi_0 + sum Q_1 nabla_theta pi_1 + sum Q_2 nabla_theta pi_2 + dots
              $$



              That is to get good policy i.e. policy gradient we only need to move the peaks of $pi$ to match the peaks of $Q$ not only the first (state, action) but also for all subsequent (state, action)'s. This yields the same result as if we differentiate through the $Q$.






              share|improve this answer









              $endgroup$















                0












                0








                0





                $begingroup$

                We want to find the gradient of policy "return" $V$ wrt. parameters of the policy $theta$. Where the return $V$ could be written as "how good is an action $Q$ $times$ probability of taking that action $pi$".



                Consider the policy gradient, $nabla_theta V = sum_a Q nabla_theta pi + pi nabla_theta Q$



                The first term tells us to adjust the action probability proportionally to how good it is. To me it could read "if an action yields good, take more". That is to move the peak of $pi$ to match the peak of $Q$. This is a reasonable thing to do. But of course since $Q$ cannot directly guide us toward its peak, it is up to our $pi$ to luckily stumble upon the high peak of $Q$. This emphasizes the importance of exploratory nature of $pi$.



                The second term is vice versa. That is to move the peak of $Q$ to match the peak of $pi$. This is much harder a task because $Q$ is a function of both action and policy, $Q_pi_theta(s, a)$. We clearly don't have this in a differentiable form i.e. we don't have a universal $Q$ function over the space of all possible $pi$.



                We now have a partial gradient from the first term but we have yet to estimate the second term.



                Turns out, the second term can be recursively written solely in the form of the first term but with subsequent actions and states.



                $$
                nabla_theta V_0 = sum Q_0 nabla_theta pi_0 + sum Q_1 nabla_theta pi_1 + sum Q_2 nabla_theta pi_2 + dots
                $$



                That is to get good policy i.e. policy gradient we only need to move the peaks of $pi$ to match the peaks of $Q$ not only the first (state, action) but also for all subsequent (state, action)'s. This yields the same result as if we differentiate through the $Q$.






                share|improve this answer









                $endgroup$



                We want to find the gradient of policy "return" $V$ wrt. parameters of the policy $theta$. Where the return $V$ could be written as "how good is an action $Q$ $times$ probability of taking that action $pi$".



                Consider the policy gradient, $nabla_theta V = sum_a Q nabla_theta pi + pi nabla_theta Q$



                The first term tells us to adjust the action probability proportionally to how good it is. To me it could read "if an action yields good, take more". That is to move the peak of $pi$ to match the peak of $Q$. This is a reasonable thing to do. But of course since $Q$ cannot directly guide us toward its peak, it is up to our $pi$ to luckily stumble upon the high peak of $Q$. This emphasizes the importance of exploratory nature of $pi$.



                The second term is vice versa. That is to move the peak of $Q$ to match the peak of $pi$. This is much harder a task because $Q$ is a function of both action and policy, $Q_pi_theta(s, a)$. We clearly don't have this in a differentiable form i.e. we don't have a universal $Q$ function over the space of all possible $pi$.



                We now have a partial gradient from the first term but we have yet to estimate the second term.



                Turns out, the second term can be recursively written solely in the form of the first term but with subsequent actions and states.



                $$
                nabla_theta V_0 = sum Q_0 nabla_theta pi_0 + sum Q_1 nabla_theta pi_1 + sum Q_2 nabla_theta pi_2 + dots
                $$



                That is to get good policy i.e. policy gradient we only need to move the peaks of $pi$ to match the peaks of $Q$ not only the first (state, action) but also for all subsequent (state, action)'s. This yields the same result as if we differentiate through the $Q$.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 27 at 3:59









                PhizazPhizaz

                62




                62



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Data Science Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f46266%2funderstanding-policy-gradient-theorem-what-does-it-mean-to-take-gradients-of-r%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Францішак Багушэвіч Змест Сям'я | Біяграфія | Творчасць | Мова Багушэвіча | Ацэнкі дзейнасці | Цікавыя факты | Спадчына | Выбраная бібліяграфія | Ушанаванне памяці | У філатэліі | Зноскі | Літаратура | Спасылкі | НавігацыяЛяхоўскі У. Рупіўся дзеля Бога і людзей: Жыццёвы шлях Лявона Вітан-Дубейкаўскага // Вольскі і Памідораў з песняй пра немца Адвакат, паэт, народны заступнік Ашмянскі веснікВ Минске появится площадь Богушевича и улица Сырокомли, Белорусская деловая газета, 19 июля 2001 г.Айцец беларускай нацыянальнай ідэі паўстаў у бронзе Сяргей Аляксандравіч Адашкевіч (1918, Мінск). 80-я гады. Бюст «Францішак Багушэвіч».Яўген Мікалаевіч Ціхановіч. «Партрэт Францішка Багушэвіча»Мікола Мікалаевіч Купава. «Партрэт зачынальніка новай беларускай літаратуры Францішка Багушэвіча»Уладзімір Іванавіч Мелехаў. На помніку «Змагарам за родную мову» Барэльеф «Францішак Багушэвіч»Памяць пра Багушэвіча на Віленшчыне Страчаная сталіца. Беларускія шыльды на вуліцах Вільні«Krynica». Ideologia i przywódcy białoruskiego katolicyzmuФранцішак БагушэвічТворы на knihi.comТворы Францішка Багушэвіча на bellib.byСодаль Уладзімір. Францішак Багушэвіч на Лідчыне;Луцкевіч Антон. Жыцьцё і творчасьць Фр. Багушэвіча ў успамінах ягоных сучасьнікаў // Запісы Беларускага Навуковага таварыства. Вільня, 1938. Сшытак 1. С. 16-34.Большая российская1188761710000 0000 5537 633Xn9209310021619551927869394п

                    Partai Komunis Tiongkok Daftar isi Kepemimpinan | Pranala luar | Referensi | Menu navigasidiperiksa1 perubahan tertundacpc.people.com.cnSitus resmiSurat kabar resmi"Why the Communist Party is alive, well and flourishing in China"0307-1235"Full text of Constitution of Communist Party of China"smengembangkannyas

                    ValueError: Expected n_neighbors <= n_samples, but n_samples = 1, n_neighbors = 6 (SMOTE) The 2019 Stack Overflow Developer Survey Results Are InCan SMOTE be applied over sequence of words (sentences)?ValueError when doing validation with random forestsSMOTE and multi class oversamplingLogic behind SMOTE-NC?ValueError: Error when checking target: expected dense_1 to have shape (7,) but got array with shape (1,)SmoteBoost: Should SMOTE be ran individually for each iteration/tree in the boosting?solving multi-class imbalance classification using smote and OSSUsing SMOTE for Synthetic Data generation to improve performance on unbalanced dataproblem of entry format for a simple model in KerasSVM SMOTE fit_resample() function runs forever with no result