NEAT (NeuroEvolution of Augmenting Topologies) is an algorithm which applies genetic algorithm to evolve both, the weights and topology of a neural network. This code in this repository implements NEAT for Gym Environments like the LunarLander.
- neat-python
- graphviz
- gym (including box2d environments)
You can run this repository either on colab or locally.
Run the Colab Notebook to run this repository directly
- Run the train.py script with the necessary arguments as described in the help menu of the CLI by running
python train.py --help
. - To train on default settings, run
python train.py
- You can also stop the training in between and continue it using the
--load_ckpt
argument and passing the path of the checkpoint. For example,python train.py --load_ckpt checkpoint_G49
- By default, the best trained genome is saved as a
best.genome
file.
-
Test the trained genome by executing the run.py file with the necessary arguments described in the help menu,
python run.py --help
. -
On default settings, to run and watch the simulation on the trained genome (
best.genome
),python run.py --render
. -
To run the evaluation consequently for large episodes,
python run.py --episodes 100
. -
You can accesss the trained model and results under trained_files/ including the resulting neural network and plots of fitness and speciation.
- Efficient Evolution of Neural Network Topologies (short version of NEAT)
- Evolving Neural Networks through Augmenting Topologies (full version of NEAT)
- NEAT-Python Documentation