1 Introduction

DEAP is built on Python and designed for both practitioners and researchers who need fast prototyping or technical experiments using evolutionary computation. It was introduced at GECCO 2012 [2], and has been widely used by researchers from many different backgrounds [1, 7, 9, 11]. Its design aim is to provide users with appropriate tools so that they can easily write their own evolutionary loops, while supporting parallelism transparently. The latest release version of DEAP is 1.2.2, and supports both Python 2 and 3. DEAP is maintained by Computer Vision and Systems Laboratory (CVSL) at Laval University, Canada, and is available from https://github.com/DEAP/deap.

2 Major Features

Written in Python, DEAP can be run on Linux, Microsoft Windows, and Mac OS X. It requires Python 2.6 or above. By default, DEAP supports array-like representations as well as the tree-based representation that enables tree GP. Users can configure and execute Genetic Programming in an intuitive and declarative manner using DEAP. At its core, DEAP implements its evolutionary algorithm using pluggable genetic and selection operators. Users can create various flavours of Genetic Programming and Genetic Algorithms by combining different parts at the API level. Many widely used genetic operators are already implemented within DEAP. Consider the code snippet in Fig. 1, which sets up a single objective (Line 5) tree GP (Line 6) with half and half ramping initialisation (Line 9), three-way tournament selection (Line 13), single point crossover (Line 14) and subtree regeneration mutation of maximum depth 2 (Line 15). The fitness function is a user-defined Python function called myEval (Line 18), which can accept arbitrary arguments. Finally, both crossover and mutation are constrained by tree height of 10 (Lines 20 and 21).

Fig. 1
figure 1

An example evolutionary loop written in DEAP

3 Weaknesses

Let us discuss what we think are weaknesses of DEAP. First, a basic knowledge of Python is essential. DEAP is a programming library, and running GP with DEAP means writing a Python program, however simple it may be. Therefore, for beginners, the developers of DEAP have provided various working examples. Second, there is no Graphical User Interface (GUI) and support for graphical plots is rather weak. While the lack of a GUI is expected as a programming library, DEAP does not support graphical plotting of experimental results, such as found in jMetal [3]. The only type of plot supported by DEAP is individual geneology.Footnote 1 Finally, the programming language itself has performance limitations. Python is an interpreted language and, is on average, much slower than compiled languages, such as C. For applications with expensive fitness computation, this may be a significant weakness.

4 Strengths

Despite the weaknesses, we highly recommend DEAP not only as a GP library but also for other evolutionary algorithms, regardless of the level of GP expertise the user has. For those who wants to use Genetic Programming for the first time, DEAP provides all the basic data structures, genetic operators, and basic examples, so that the user can quickly implement an evolutionary loop. If the user is already familiar with GP, DEAP is sufficiently flexible to allow more advanced variants, such as fitness evaluation using parallel graphics hardware, GPGPU [5, 6].

We also consider the fact that DEAP is written in Python as a benefit, as it is arguably one of the most popular languages for data scientists. There are a wide variety of data processing and other machine learning algorithm libraries that are written in Python (for example, data processing library pandas [8] and general machine learning library scikit-learn [10]): we think the interoperability through the shared programming language will help those who have never experienced GP before to adopt it as a learning technique more easily. The benefits of Python go beyond the popularity of the language. Python is an interpreted language that also allows on-the-fly compilation of textual code to Python bytecode: for GP, this means that non-terminal GP node operators can be just Python functions, and fitness evaluation can be execution of compiled individual in the format of function calls.

Finally, as its name suggests, DEAP supports various levels of parallelism ranging from Python’s multiprocessing to distributed grid computing. This is achieved via a mature concurrent computation framework called SCOOP (Scalable Concurrent Operations in Python) [4].

5 Conclusions

DEAP is a well designed GP library for novices and experts alike. It is easy to use, ideal for both fast prototyping and grid-computing level distributed experiments. The fact that it is written in Python will not only allow easier adoption for many researchers and practitioners but also mean that it can be used with many other Python libraries for data processing and machine learning.