# ahmedfgad/GeneticAlgorithmPython

Source code of PyGAD, a Python 3 library for building the genetic algorithm and training machine learning algorithms (Keras & PyTorch).

Repository: https://github.com/ahmedfgad/GeneticAlgorithmPython
Canonical: https://ross.abutalabs.com/products/geneticalgorithmpython
Homepage: https://pygad.readthedocs.io
Language: Python
License: BSD-3-Clause
License Family: permissive
Topics: python, genetic-algorithm, optimization, numpy, pygad, pygad-documentation, neural-networks, machine-learning, deep-learning, evolutionary-algorithms
Last push: 2026-07-09T04:06:44+00:00

## Health v2 (maintenance only)
Score: 80/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 91, release rhythm 55, longevity 100
- inputs: {"age_days": 2822, "days_push": 55, "days_rel": 89, "gap_med": 182, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2220, forks 500 (observed 2026-08-28T04:06:27.547715+00:00)

## What it is
PyGAD is an open-source Python 3 library for implementing the genetic algorithm to optimize single- and multi-objective problems. It can also train machine learning models, with built-in support for Keras and PyTorch neural networks.

## Use cases
- solve optimization problems with a genetic algorithm in python
- train keras neural networks using a genetic algorithm
- optimize pytorch model weights with evolutionary search
- run multi-objective optimization in python
- find optimal parameters with a metaheuristic instead of gradient descent
- feature selection using genetic algorithms

## When to choose
- you need a simple, well-documented genetic algorithm library in Python
- you want to train or fine-tune Keras/PyTorch models without gradients
- your objective function is non-differentiable or black-box
- you need both single- and multi-objective evolutionary optimization

## When to avoid
- you need industrial-strength large-scale evolutionary computation with massive parallelism
- your problem is smooth and differentiable, where standard gradient-based optimizers are faster
- you need other metaheuristics like particle swarm or simulated annealing out of the box

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, deep-learning
- domain: machine-learning, artificial-intelligence, deep-learning
- platform: python
- tags: genetic-algorithm, evolutionary-algorithms, optimization, numpy, keras, pytorch, metaheuristics, multi-objective-optimization

## Member repositories
- ahmedfgad/GeneticAlgorithmPython (main) score 80

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:27.547715+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:45:49.936979+00:00, confidence not recorded.
  - readme: https://github.com/ahmedfgad/GeneticAlgorithmPython (fetched 2026-08-28T04:06:27.547715+00:00, sha d1abe20af2dd)
- Data as of 2026-08-30T08:39:29.467469+00:00.
