Happy-Algorithms-League / hal-cgp

Licence: GPL-3.0 license
Cartesian genetic programming (CGP) in pure Python.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to hal-cgp

geppy
A framework for gene expression programming (an evolutionary algorithm) in Python
Stars: ✭ 124 (+520%)
Mutual labels:  symbolic-regression, evolutionary-algorithm
evolvable
An evolutionary computation framework
Stars: ✭ 43 (+115%)
Mutual labels:  evolutionary-algorithm
goga
Go evolutionary algorithm is a computer library for developing evolutionary and genetic algorithms to solve optimisation problems with (or not) many constraints and many objectives. Also, a goal is to handle mixed-type representations (reals and integers).
Stars: ✭ 39 (+95%)
Mutual labels:  evolutionary-algorithm
DeepSymReg
Official repository for the paper "Integration of Neural Network-Based Symbolic Regression in Deep Learning for Scientific Discovery"
Stars: ✭ 35 (+75%)
Mutual labels:  symbolic-regression
Evagents
A "Natural" Selection Simulator using Neural Nets
Stars: ✭ 19 (-5%)
Mutual labels:  evolutionary-algorithm
AI physicist
AI Physicist, a paradigm with algorithms for learning theories from data, by Wu and Tegmark (2019)
Stars: ✭ 23 (+15%)
Mutual labels:  symbolic-regression
trsh
Project about minimizing costs in garbage collection in Montevideo, Uruguay, using Evolutionary Algorithms
Stars: ✭ 17 (-15%)
Mutual labels:  evolutionary-algorithm
TetrisAI
The old school Tetris game in addition with an AI that learns evolutionary how to play this game
Stars: ✭ 24 (+20%)
Mutual labels:  evolutionary-algorithm
SimpleGP
Simple Genetic Programming for Symbolic Regression in Python3
Stars: ✭ 20 (+0%)
Mutual labels:  symbolic-regression
Symbolic-Regression
predicting equations from raw data with deep learning
Stars: ✭ 48 (+140%)
Mutual labels:  symbolic-regression
Data Analysis And Machine Learning Projects
Repository of teaching materials, code, and data for my data analysis and machine learning projects.
Stars: ✭ 5,166 (+25730%)
Mutual labels:  evolutionary-algorithm
GeneticAlgorithmForFeatureSelection
Search the best feature subset for you classification mode
Stars: ✭ 82 (+310%)
Mutual labels:  evolutionary-algorithm
bio ik
MoveIt kinematics_base plugin based on particle optimization & GA
Stars: ✭ 104 (+420%)
Mutual labels:  evolutionary-algorithm
Robyn
Robyn is an experimental, automated and open-sourced Marketing Mix Modeling (MMM) package from Facebook Marketing Science. It uses various machine learning techniques (Ridge regression with cross validation, multi-objective evolutionary algorithm for hyperparameter optimisation, gradient-based optimisation for budget allocation etc.) to define m…
Stars: ✭ 433 (+2065%)
Mutual labels:  evolutionary-algorithm
Dino-AI
An AI to teach Google Chrome's dinosaur to jump obstacles.
Stars: ✭ 15 (-25%)
Mutual labels:  evolutionary-algorithm
moead-py
A Python implementation of the decomposition based multi-objective evolutionary algorithm (MOEA/D)
Stars: ✭ 56 (+180%)
Mutual labels:  evolutionary-algorithm
vita
Vita - Genetic Programming Framework
Stars: ✭ 24 (+20%)
Mutual labels:  symbolic-regression
paradiseo
An evolutionary computation framework to (automatically) build fast parallel stochastic optimization solvers
Stars: ✭ 73 (+265%)
Mutual labels:  evolutionary-algorithm
apxr run
A topology and parameter evolving universal learning network.
Stars: ✭ 14 (-30%)
Mutual labels:  evolutionary-algorithm
cartesian
a lightweight implementation of Cartesian genetic programming with symbolic regression in mind.
Stars: ✭ 21 (+5%)
Mutual labels:  symbolic-regression

HAL-CGP

https://coveralls.io/repos/github/Happy-Algorithms-League/python-gp/badge.svg?branch=master https://readthedocs.org/projects/hal-cgp/badge/?version=latest

Cartesian genetic programming (CGP) in pure Python.

hal-cgp is an extensible pure Python library implementing Cartesian genetic programming to represent, mutate and evaluate populations of individuals encoding symbolic expressions targeting applications with computationally expensive fitness evaluations. It supports the translation from a CGP genotype, a two-dimensional Cartesian graph, into the corresponding phenotype, a computational graph implementing a particular mathematical expression. These computational graphs can be exported as pure Python functions, NumPy-compatible functions (Walt et al., 2011), SymPy expressions (Meurer et al., 2017) or PyTorch modules (Paszke et al., 2019).

The library implements a mu + lambda evolution strategy (Beyer and Schwefel, 2002) to evolve a population of individuals to optimize an objective function.

Design decisions/use cases

We designed hal-cgp for optimization problems in which individual fitness evaluations are computationally expensive. The library is hence not optimized for high performance, but rather puts ease of use and extensibility first. Furthermore we take steps to reduce the number of redundant fitness evaluations, for example by avoiding reevaluating parents at the beginning of each episode and providing a convenient decorator to cache results on disk. If for your use case individual fitness evaluations are fast and the performance of the library itself becomes a relevant factor, you may want to check out https://github.com/darioizzo/dcgp or http://www.cgplibrary.co.uk/files2/About-txt.html.

CGP Sketch

Figure from Jordan, Schmidt, Senn & Petrovici, "Evolving to learn: discovering interpretable plasticity rules for spiking networks", arxiv:2005.14149.

Installation

You can install the latest relase via pip:

pip install hal-cgp

This library depends on some optional packages defined in extra_requirements.txt. These are necessary, for example, to compile an individual to a SymPy expression or a PyTorch class. You can install the extra requirements for full functionality of the library via:

pip install hal-cgp[extra]

You can also install individual extra requirements by specifying the package name (without version number) in square brackets, e.g., to install the torch dependency:

pip install hal-cgp[torch]

The adventurous can install the most recent development version directly from our master branch (don't use this in production unless there are good reasons!):

git clone [email protected]:Happy-Algorithms-League/hal-cgp.git
cd hal-cgp
pip install .[all]

Basic usage

For detailed documentation, please refer to https://happy-algorithms-league.github.io/hal-cgp/. Here we only provide a preview.

Follow these steps to solve a basic regression problem:

  1. Define an objective function. The objective function takes an individual as an argument and updates the fitness of the individual.

    def objective(individual):
        individual.fitness = ...
        return individual
  2. Define a callback function to record information about the progress of the evolution:

    history = {}
    history["fitness_parents"] = []
    def recording_callback(pop):
        history["fitness_parents"].append(pop.fitness_parents())
  3. Use the evolve function that uses default hyperparameters and starts the evolution:

    cgp.evolve(obj, print_progress=True, callback=recording_callback)

References

Beyer, H.-G. and Schwefel, H.-P. (2002). Evolution strategies–a comprehensive introduction. Natural computing, 1(1):3–52.

Meurer, A., Smith, C. P., Paprocki, M., Certik, O., Kirpichev, S. B., Rocklin, M., ... & Rathnayake, T. (2017). SymPy: Symbolic Computing in Python. PeerJ Computer Science, 3, e103.

Miller, J. and Thomson, P. (2000). Cartesian genetic programming. In Proc. European Conference on Genetic Programming, volume 1802, pages 121-132. Springer.

Miller, J. F. (2011). Cartesian genetic programming. In Cartesian genetic programming, pages 17-34. Springer.

Paszke, A., Gross, S., Chintala, S., Chanan, G., Yang, E., DeVito, Z., ... & Lerer, A. (2017). Automatic Differentiation in PyTorch.

Topchy, A., & Punch, W. F. (2001). Faster Genetic Programming based on Local Gradient Search of Numeric Leaf Values. In Proceedings of the Genetic and Evolutionary Computation Conference (GECCO-2001) (Vol. 155162). Morgan Kaufmann San Francisco, CA, USA.

Walt, S. v. d., Colbert, S. C., and Varoquaux, G. (2011). The numpy array: a structure for efficient numerical computation. Computing in Science & Engineering, 13(2):22–30.

Citation

If you use HAL-CGP in your work, please cite it as:

Schmidt, Maximilian & Jordan, Jakob (2020) hal-cgp: Cartesian genetic programming in pure Python. 10.5281/zenodo.3889163

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].