Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vgarciasc/cro_dt_rl
https://github.com/vgarciasc/cro_dt_rl
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/vgarciasc/cro_dt_rl
- Owner: vgarciasc
- Created: 2023-07-14T13:56:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-28T20:23:59.000Z (8 months ago)
- Last Synced: 2024-10-07T15:23:34.201Z (about 1 month ago)
- Language: Python
- Size: 39.2 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CRO-DT-RL
This repository contains the code for the paper "Evolving Interpretable Decision Trees for Reinforcement Learning".
It uses the Coral Reef Optimization algorithm (implemented through [PyCRO-SL](https://github.com/jperezaracil/PyCROSL)) to evolve DTs for RL.## How to run
The entry point is the file `cro_dt_rl/cro_dt_rl.py`, which effectively runs the CRO algorithm. It has the following params:
- `--task`: the RL task to solve. Can be `cartpole`, `mountain-car`, `lunar-lander` or `dssat`.
- `--cro_config`: the file containing the CRO configuration. See `configs/simple_erl_test.json` for an example.
- `--depth`: the depth of the randomly generated trees.
- `--alpha`: the alpha parameter for the CRO algorithm (determines the weight of tree size).
- `--initial_pop`: file that contains the initial population of trees. If not provided, the population will be randomly generated.
- `--initial_pop_individual`: if True, each simulation will use a different individual from the initial population provided. If False, all individuals from the initial population will be used in each simulation.
- `--episodes`: number of episodes to run when evaluating each individual's fitness.
- `--simulations`: how many simulations to run the CRO-DT-RL algorithm for.
- `--output_prefix`: what should be the prefix of the output file.
- `--n_jobs`: number of parallel jobs to run.
- `--verbose`: if True, the algorithm will print information about the evolution process. True by default.Two output files will be created: one with the best individual from each simulation, and one with all the statistics from every generation, which is updated constantly.
## Initial population
The initial population can be provided through the `--initial_pop` parameter. Examples of these files can be found in the `final_results` folder.
Note that to obtain these files, it is required to run Imitation Learning and Reward Pruning algorithms. **The code for these algorithms can be found in the [erltrees](https://github.com/vgarciasc/erltrees) repository, alongside the DT real-time visualization tool**. These two repositories are separated to facilitate users who want to simply toy with DTs for RL, without using CRO-DT-RL specifically.