GithubHelp home page GithubHelp logo

Question regarding SAC discrete about rljax HOT 8 CLOSED

zmce2018 avatar zmce2018 commented on July 17, 2024
Question regarding SAC discrete

from rljax.

Comments (8)

toshikwa avatar toshikwa commented on July 17, 2024

Hi @zmce2018

Let me assure you what kind of env you want to use.
Which is your situation?

  • Multiple environments (N obs, N actions)
  • One env with multiple actions (1 obs, N actions)

Thanks :)

from rljax.

zmce2018 avatar zmce2018 commented on July 17, 2024

Hi @ku2482 One env with multiple actions (1 obs, N actions). Thank you

from rljax.

toshikwa avatar toshikwa commented on July 17, 2024

I think you have two options.

1
Consider N action space A as one action space A^N.
Which is often used, for example, the env which has action spaces (left, None, right) and (forward, None, backward).
As a result, the action space has 9 actions.
However, actions increase exponentially.

2
Train SAC-Discrete with MultiCategorical distribution. In other words, train SAC-Discrete with N actor's and critic's heads.

I think option 2 can be a reasonable candidate.
Does it answer your question?

Thanks:)

from rljax.

zmce2018 avatar zmce2018 commented on July 17, 2024

Hi @ku2482

1 would be infeasible. The second seems okay at first glance. However, if you build N actors and critics, the agent is learning each action space independently. (Agent would not be able to know which action drives the reward).

Am I understanding it correctly?
Thank you.

from rljax.

toshikwa avatar toshikwa commented on July 17, 2024

Suppose, you have a special cart pole game where you have to handle 10 cart poles simultaneously

In this explanation, I thought that each (underlying) dynamics was independent. Are these dynamics dependent?

from rljax.

zmce2018 avatar zmce2018 commented on July 17, 2024

Thank you, Ku

Yes, dynamics dependent. You can think of it as humanoid but each action space is a discrete action.

Thank you for your patient.

from rljax.

toshikwa avatar toshikwa commented on July 17, 2024

I see.
You can still model the policy as multiple categorical distributions that share some layers.
\pi(a|s) = \pi_1(a_1|s) * \pi_2(a_2|s) * ...

However, if each action spaces are dependent, you have to evaluate the values of |A|^N sets of actions.
So you need to model Q function which outputs |A|^N values because you need Q values at all action sets to calculate the expectations. It would be infeasible when N is large.

Or you may be able to model Q function which input state and N one-hot actions, and output a scalar. In this case, you can compute the expectations as the sample means. It is no longer SAC-Discrete, it's Soft Actor-Critic. (I don't think it's smart.)

I'm sorry that I can't come up with a smart solution...

BTW, please call me Toshiki.
Thanks.

from rljax.

zmce2018 avatar zmce2018 commented on July 17, 2024

Thank you so much for your explanation, Toshiki.
That answers my question.

from rljax.

Related Issues (3)

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.