简体   繁体   English

如何获得 integer 作为 output 用于连续动作空间 PPO 强化学习?

[英]How can I get an integer as output for continuous action space PPO reinforcement learning?

I have a huge discrete action space, the learning stability is not good.我有一个巨大的离散动作空间,学习稳定性不好。 I'd like to move to continuous action space but the only output for my task can be a positive integer (let's say in the range 0 to 999).我想移动到连续动作空间,但我的任务唯一的 output 可以是正的 integer(假设在 0 到 999 的范围内)。 How can I force the DNN to output a positive integer?如何强制 DNN 到 output 为正 integer?

Could you please specify which framework for RL agents you are using and which kind of environment?您能否具体说明您正在使用哪种 RL 代理框架以及哪种环境?

Assuming that you are using Stable Baselines 3 (SB3) with OpenAI gym environment, you should be able to set the desired action space when you set up the environment (see here: https://www.gymlibrary.ml/content/spaces/ ).假设您在 OpenAI 健身房环境中使用 Stable Baselines 3 (SB3),您应该能够在设置环境时设置所需的动作空间(参见此处: https://www.gymlibrary.ml/content/spaces/ )。 PPO is one of SB3's most versatile agents that can be used for "Discrete", "Box", "MultiDiscrete" and "MultiBinary" action spaces. PPO 是 SB3 最通用的代理之一,可用于“离散”、“盒子”、“多离散”和“多二进制”动作空间。

Lastly to get an output of a positive integer only, can be achieved in several ways:最后要得到一个正 integer 的 output ,可以通过以下几种方式实现:

  • if your output is for example Box(low=-1.0, high=1.0, shape=(1,) it would be just about scaling that output to the desired range and converting it to an int.如果您的 output 是例如Box(low=-1.0, high=1.0, shape=(1,)它只是将 output 缩放到所需范围并将其转换为整数。
  • another option is to define your output as Box(low=-1.0, high=1.0, shape=(N_DISCRETE_ACTIONS,) and then get the final integer with a np.argmax(action)另一种选择是将您的 output 定义为Box(low=-1.0, high=1.0, shape=(N_DISCRETE_ACTIONS,)然后使用np.argmax(action)获得最终的 integer
  • the direct way would be to define the action space as a Discrete(N_DISCRETE_ACTIONS)直接的方法是将动作空间定义为Discrete(N_DISCRETE_ACTIONS)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 利用强化学习进行多智能体连续空间路径寻找的最佳算法 - Best algorithm for multi agent continuous space path finding using Reinforcement learning 如何将 output 数组作为深度强化学习 Model 中的操作? - How to output an array as actions in a Deep Reinforcement Learning Model? 如何使用强化学习在图中找到不同人的步行路径? - How can I Find Walking Paths for Different People in a Graph With Reinforcement Learning? 如何在 openai-gym、强化学习的 Bipedalwalker-v3 中获得目标 Q 值? - How do I get Target Q-values in Bipedalwalker-v3 in openai-gym, reinforcement learning? 在任意较大的动作/状态空间中进行强化学习 - Reinforcement Learning in arbitrarily large action/state spaces 如何将 Drake 与深度强化学习一起使用 - How to use Drake with deep reinforcement learning 如何在深度学习和计算机视觉中输出特定图像 - How can I output a specific images in Deep Learning & Computer Vision 用Keras模型进行强化学习 - Reinforcement Learning with Keras model 深度强化学习,如何制作控制多台机器的代理 - Deep Reinforcement Learning, how to make an agent that control many machines 深度强化学习 - CartPole 问题 - Deep Reinforcement Learning - CartPole Problem
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM