Git Product home page Git Product logo

Comments (11)

RylanSchaeffer avatar RylanSchaeffer commented on July 19, 2024

Moreover, if you use only 1 episode to train, then the gradient will always be 0. This is because grad_J_episode is computed as:

grad_J_episode = sum_d_log_pi * (J - baseline)

and plugging in the baseline:

grad_J_episode = sum_d_log_pi * (J - J * sum_d_log_pi / sum_d_log_pi) = sum_d_log_pi * (J - J) = 0

Consequently, with this choice of baseline, an agent trained from single episodes will never learn.

from mushroom-rl.

boris-il-forte avatar boris-il-forte commented on July 19, 2024

The baseline implementation is correct. This is the elementwise baseline, not the basic one.

Please, refer to the RL literature about this topic:
Marc Peter Deisenroth; Gerhard Neumann; Jan Peters, A Survey on Policy Search for Robotics, 2013.
https://ieeexplore.ieee.org/document/8186816

Also, the fact that the baseline is zero for a single episode trivially comes from the definition of baseline.

from mushroom-rl.

RylanSchaeffer avatar RylanSchaeffer commented on July 19, 2024

You misread what I wrote. The baseline isn't zero. The gradient is zero.

from mushroom-rl.

RylanSchaeffer avatar RylanSchaeffer commented on July 19, 2024

Consequently, if you train the agent only one episode at a time, then the gradient is always zero and the agent will never learn even if given infinite data and infinite time.

That cannot be correct.

from mushroom-rl.

RylanSchaeffer avatar RylanSchaeffer commented on July 19, 2024

Your citation is a book. Can you please be a little more precise?

from mushroom-rl.

boris-il-forte avatar boris-il-forte commented on July 19, 2024

The citation is a survey paper.

The fact that the gradient is zero depends exactly on the meaning of the baseline.

from mushroom-rl.

RylanSchaeffer avatar RylanSchaeffer commented on July 19, 2024

from mushroom-rl.

boris-il-forte avatar boris-il-forte commented on July 19, 2024

The normal use case for REINFORCE is to use multiple trajectories to estimate the gradient.

We will put an assert to ensure that the user cannot run the algorithm with a single trajectory.

from mushroom-rl.

RylanSchaeffer avatar RylanSchaeffer commented on July 19, 2024

from mushroom-rl.

boris-il-forte avatar boris-il-forte commented on July 19, 2024

this is also a behavior that we could consider. we will choose the option that minimizes the code.

REINFORCE without baseline and with a single trajectory is basically a useless algorithm, so it's not worth supporting this use case if it makes the code less clean.

from mushroom-rl.

RylanSchaeffer avatar RylanSchaeffer commented on July 19, 2024

from mushroom-rl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.