Meet NEvoPy, a neuroevolution framework for Python

Talendar
3 min readFeb 13, 2021
NEvoPy’s logo.

TL;DR: check out this awesome neuroevolution framework for Python!

Hey, guys! Talendar here. Although I’ve been studying machine learning (especially deep learning) for a while, only recently I’ve taken interest in neuroevolution. For those who are not familiar with the term, it refers to the use of evolutionary algorithms to generate neural networks. It’s a vast and expanding area of research, still very unexplored.

After reading some papers on the subject, I decided to code the NEAT algorithm (NeuroEvolution of Augmenting Topologies), which I found really neat (hehe), just for fun. As I was coding (using Python), I noticed that there are very few neuroevolution libraries/frameworks for Python, and those that do exist are usually focused on the implementation of a single algorithm (like NEAT or CoDeepNEAT). With that in mind, I took my existing code and created a project out of it — and thus NEvoPy was born.

I’ve have really big plans for NEvoPy. I want it to implement many different neuroevolution algorithms and make them accessible through a simple and (as far as possible) similar API. Currently, NEvoPy implements the NEAT algorithm and the standard fixed-topology neuroevolution algorithm (with support for deep neural networks and TensorFlow). I’ve plans, however, to implement many others algorithms, such as HyperNEAT, CoDeepNeat and Weight Agnostic Neuroevolution (yeah, this is a thing!). In this regard, I’ve already defined an API that is simple and flexible enough to accommodate different neuroevolutionary algorithms. I’ve also implemented a generalizable genetic algorithm that can be used as a base for most algorithms.

Some of the stuff I’ve already used NEvoPy for. Links: Flappy Bird, Lunar Lander and Cart Pole examples

Just implementing the algorithms isn’t enough, though. Those of you who have already played a little with neuroevolution probably know how slow it can be. For NEvoPy to be fast, it needs to be highly optimized. In this regard, I’ve already taken a first step: in NEvoPy, the implementation of the computing methods is encapsulated on what I call processing schedulers and is separated from the implementation of the neuroevolutionary algorithms. This allows new computing methods to be easily added to the framework.

The pool processing scheduler, for instance, uses Python’s multiprocessing package to implement parallel processing on CPUs. The ray processing scheduler, on the other hand, uses the ray framework to implement parallel processing on CPUs and GPUs, both on a single machine or on multiple machines (a cluster!). I’m now working on the network processing scheduler, which will allow the processing to be split among different machines on the Internet (ray supposedly has support for that, but I could only make it work within a local network).

If you had the patience to read all of this, if you’re as interested in neuroevolution as I am and if you like Python, then you are probably who I’m looking for. Check out NEvoPy’s GitHub repo here and consider contributing to the project, either with code or with advice.

Please, let me know what you think. Any constructive criticism is welcome and appreciated. Thank you for your time!

--

--

Talendar

Computer Science student at the University of São Paulo (USP). Check out some of my personal projects on my GitHub page: github.com/Talendar