[Feature Request] Create a categorical tensorspec and make DQN primitives compatible with non-one-hot encoding
Open
@vmoens is already working on this.
Since Oct 7, 2022.
enhancement
- Dominant language
- Python
- Stars
- 3.6k
- Forks
- 484
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 207
Description
Motivation
We opted for default one-hot encoding for categorical data because it facilitates the retrieval of action values:
chosen_action_value = action * action_values
However, this is not scalable to large action spaces.
We should make it possible to use integers instead.
To make this possible, the following changes are needed:
- Create a
DiscreteTensorSpecsimilar toMultOneHotDiscreteTensorSpec+ tests - Change QValueHook to make it possible to use a "categorical" space (or similar) instead of "one_hot"
- Do the same with
DistributionalQValueHook - Adapt the DQNLoss to these changes
- Adapt the DistributionalDQNLoss to these changes
- Change the gym specs reader here to make it possible to choose one spec type or the other. One way to go about this would be to have a global variable that controls which categorical encoding must be used
Then we can use this in all the code-base to choose one or the other encoding.ONE_HOT_ENCODING = os.environ.get("ONE_HOT_ENCODING", True)
All these features should be unit-tested and parametrisable (e.g. with ONE_HOT_ENCODING) in the DQN training scripts.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.