PyGAD
PyGAD is an open-source Python 3 library for implementing the genetic algorithm and optimizing machine learning algorithms.
PyGAD supports different types of crossover, mutation, and parent selection. PyGAD allows different types of problems to be optimized using the genetic algorithm by customizing the fitness function.
Besides building the genetic algorithm, it builds and optimizes machine learning algorithms. Currently, PyGAD supports building and training (using genetic algorithm) artificial neural networks for classification problems.
The library is under active development and more features in the genetic algorithm will be added like working with binary problems. This is in addition to supporting more machine learning algorithms.
Tutorial Project
IMPORTANT If you are coming for the code of the tutorial titled Genetic Algorithm Implementation in Python, then it has been moved to the [Tutorial Project](https://github.com/ahmedfgad/GeneticAlgorithmPython/tree/master/Tutorial Project) directory on 06 May 2020.
Installation
To install PyGAD, simply use pip to download and install the library from PyPI (Python Package Index). The library lives a PyPI at this page https://pypi.org/project/pygad.
For Windows, issue the following command:
pip install pygadFor Linux and Mac, replace pip by use pip3 because the library only supports Python 3.
pip3 install pygadPyGAD is developed in Python 3.7.3 and depends on NumPy for creating and manipulating arrays and Matplotlib for creating figures. The exact NumPy version used in developing PyGAD is 1.16.4. For Matplotlib, the version is 3.1.0.
To get started with PyGAD, please read the documentation at Read The Docs https://pygad.readthedocs.io.
PyGAD Source Code
The source code of the PyGAD' modules is found in the following GitHub projects:
The documentation of PyGAD is available at Read The Docs https://pygad.readthedocs.io.
PyGAD Documentation
The documentation of the PyGAD library is available at Read The Docs at this link: https://pygad.readthedocs.io. It discusses the modules supported by PyGAD, all its classes, methods, attribute, and functions. For each module, a number of examples are given.
If there is an issue using PyGAD, feel free to post at issue in this GitHub repository https://github.com/ahmedfgad/GeneticAlgorithmPython or by sending an e-mail to ahmed.f.gad@gmail.com.
If you built a project that uses PyGAD, then please drop an e-mail to ahmed.f.gad@gmail.com with the following information so that your project is included in the documentation.
- Project title
- Brief description
- Preferably, a link that directs the readers to your project
Please check the Contact Us section for more contact details.
For More Information
There are different resources that can be used to get started with the genetic algorithm and building it in Python.
Tutorial: Implementing Genetic Algorithm in Python
To start with coding the genetic algorithm, you can check the tutorial titled Genetic Algorithm Implementation in Python available at these links:
This tutorial is prepared based on a previous version of the project but it still a good resource to start with coding the genetic algorithm.
Tutorial: Introduction to Genetic Algorithm
Get started with the genetic algorithm by reading the tutorial titled Introduction to Optimization with Genetic Algorithm which is available at these links:
Tutorial: Build Neural Networks in Python
Read about building neural networks in Python through the tutorial titled Artificial Neural Network Implementation using NumPy and Classification of the Fruits360 Image Dataset available at these links:
Tutorial: Optimize Neural Networks with Genetic Algorithm
Read about training neural networks using the genetic algorithm through the tutorial titled Artificial Neural Networks Optimization using Genetic Algorithm with Python available at these links:
Book: Practical Computer Vision Applications Using Deep Learning with CNNs
You can also check my book cited as Ahmed Fawzy Gad 'Practical Computer Vision Applications Using Deep Learning with CNNs'. Dec. 2018, Apress, 978-1-4842-4167-7 which discusses neural networks, convolutional neural networks, deep learning, genetic algorithm, and more.
Find the book at these links:




