Skip to main content

A package for genetic optimization and symbolic regression

Project description

Bingo Logo

master: Build Status Coverage Status

develop: Build Status Coverage Status

Description

Bingo is an open source package for performing symbolic regression, though it can be used as a general purpose evolutionary optimization package.

Key Features

  • Integrated local optimization strategies
  • Parallel island evolution strategy implemented with mpi4py
  • Coevolution of fitness predictors

Quick Start

Documentation

Full Documentation Here

Installation

To install Bingo, simply use pip. Unfortunately the pip install is currently not working. Please use source install for the time being.

pip install bingo-nasa

Usage Example

A no-fuss way of using Bingo is by using the scikit-learn wrapper: SymbolicRegressor. Let's setup a test case to show how it works.

Setting Up the Regressor

There are many options that can be set in SymbolicRegressor. Here we set some basic ones including population_size (the number of equations in a population), stack_size (the max number of nodes per equation), and use_simplification (whether to use simplification to speed up equation evaluation and for easier reading). You can see all of SymbolicRegressor's options here.

from bingo.symbolic_regression.symbolic_regressor import SymbolicRegressor
regressor = SymbolicRegressor(population_size=100, stack_size=16,
                              use_simplification=True)
/home/gbomarit/Projects/Genetic_Programming/bingo/bingo/symbolic_regression/__init__.py:31: UserWarning: Could not load C++ modules No module named 'bingocpp.build.bingocpp'
  warnings.warn(f"Could not load C++ modules {import_err}")

Training Data

Here we're just creating some dummy training data from the equation $5.0 X_0^2 + 3.5 X_0$. More on training data can be found in the data formatting guide.

import numpy as np
X_0 = np.linspace(-10, 10, num=30).reshape((-1, 1))
X = np.array(X_0)
y = 5.0 * X_0 ** 2 + 3.5 * X_0
import matplotlib.pyplot as plt
plt.scatter(X, y)
plt.xlabel("X_0")
plt.ylabel("y")
plt.title("Training Data")
plt.show()

png

Fitting the Regressor

Fitting is as simple as calling the .fit() method.

regressor.fit(X, y)
using 1 processes
 Generating a diverse population took 274 iterations.
archipelago: <class 'bingo.evolutionary_optimizers.island.Island'>
done with opt, best_ind: X_0 + (5.0)((0.49999999999999967)(X_0) + (X_0)(X_0)), fitness: 5.4391466376923e-28
reran CLO, best_ind: X_0 + (5.0)((0.4999999999999999)(X_0) + (X_0)(X_0)), fitness: 5.352980018399097e-28

Getting the Best Individual

best_individual = regressor.get_best_individual()
print("best individual is:", best_individual)
best individual is: X_0 + (5.0)((0.4999999999999999)(X_0) + (X_0)(X_0))

Predicting Data with the Best Individual

You can use the regressor's .predict(X) or the best_individual's .evaluate_equation_at(X) to get its predictions for X.

pred_y = regressor.predict(X)
pred_y = best_individual.evaluate_equation_at(X)

plt.scatter(X, y)
plt.plot(X, pred_y, 'r')
plt.xlabel("X_0")
plt.ylabel("y")
plt.legend(["Actual", "Predicted"])
plt.show()

png

Source

Installation from Source

For those looking to develop their own features in Bingo.

First clone the repo and move into the directory:

git clone --recurse-submodules https://github.com/nasa/bingo.git
cd bingo

Then make sure you have the requirements necessary to use Bingo:

conda env create -f conda_environment.yml

or

pip install -r requirements.txt

(Optional) Then build the c++ performance library BingoCpp:

./.build_bingocpp.sh

Now you should be good to go! You can run Bingo's test suite to make sure that the installation process worked properly:

pytest tests

Add Bingo to your Python path to begin using it from other directories.

export PYTHONPATH="$PYTHONPATH:/path/to/bingo/"

and test it with:

python -c 'import bingo; import bingocpp'

Contributing

  1. Fork it (https://github.com/nasa/bingo/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Citing Bingo

Please consider citing the following reference when using bingo in your works.

MLA:

Randall, David L., et al. "Bingo: a customizable framework for symbolic regression with genetic programming." Proceedings of the Genetic and Evolutionary Computation Conference Companion. 2022.

Bibtex:

@inproceedings{randall2022bingo,
  title={Bingo: a customizable framework for symbolic regression with genetic programming},
  author={Randall, David L and Townsend, Tyler S and Hochhalter, Jacob D and Bomarito, Geoffrey F},
  booktitle={Proceedings of the Genetic and Evolutionary Computation Conference Companion},
  pages={2282--2288},
  year={2022}
}

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Geoffrey Bomarito
  • Tyler Townsend
  • Jacob Hochhalter
  • David Randall
  • Ethan Adams
  • Kathryn Esham
  • Diana Vera

License

Copyright 2018 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. No copyright is claimed in the United States under Title 17, U.S. Code. All Other Rights Reserved.

The Bingo Mini-app framework is licensed under the Apache License, Version 2.0 (the "License"); you may not use this application except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 .

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bingo_nasa-0.5.0.tar.gz (2.3 MB view details)

Uploaded Source

Built Distributions

bingo_nasa-0.5.0-cp313-cp313-musllinux_1_2_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.13 musllinux: musl 1.2+ x86-64

bingo_nasa-0.5.0-cp313-cp313-musllinux_1_2_i686.whl (1.5 MB view details)

Uploaded CPython 3.13 musllinux: musl 1.2+ i686

bingo_nasa-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (385.0 kB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

bingo_nasa-0.5.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl (406.1 kB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ i686

bingo_nasa-0.5.0-cp312-cp312-musllinux_1_2_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

bingo_nasa-0.5.0-cp312-cp312-musllinux_1_2_i686.whl (1.5 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.2+ i686

bingo_nasa-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (385.1 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

bingo_nasa-0.5.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (406.3 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

bingo_nasa-0.5.0-cp311-cp311-musllinux_1_2_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

bingo_nasa-0.5.0-cp311-cp311-musllinux_1_2_i686.whl (1.5 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.2+ i686

bingo_nasa-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (386.8 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

bingo_nasa-0.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (406.3 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

bingo_nasa-0.5.0-cp310-cp310-musllinux_1_2_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

bingo_nasa-0.5.0-cp310-cp310-musllinux_1_2_i686.whl (1.5 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.2+ i686

bingo_nasa-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (385.0 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

bingo_nasa-0.5.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (404.8 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

bingo_nasa-0.5.0-cp39-cp39-musllinux_1_2_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

bingo_nasa-0.5.0-cp39-cp39-musllinux_1_2_i686.whl (1.5 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.2+ i686

bingo_nasa-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (385.2 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

bingo_nasa-0.5.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (405.3 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

File details

Details for the file bingo_nasa-0.5.0.tar.gz.

File metadata

  • Download URL: bingo_nasa-0.5.0.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for bingo_nasa-0.5.0.tar.gz
Algorithm Hash digest
SHA256 71e59460451e1b45fd64a6e46e7ca5f7bd15aa759fcf6509196c0d66dfd99145
MD5 ae89b934a446009cdfbdba276de22e40
BLAKE2b-256 bd0b9c9dc9bd818ddf33a9f7543a4db1af622af319934b940f1e68f5452f0327

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a7097ebbb903c351fbb5a01f0e99182e5a0d9a8a8660b44281bc025f6b75d6dd
MD5 7d5ca3ca3e2c459e7e64e2e8bb9d24e3
BLAKE2b-256 e8b70ab6f4f7c4dfdd60c5860b37d7447d17260122c950e02dd3d0cc99e96d38

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp313-cp313-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp313-cp313-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 465e94061ed95380b75964b12f6205a5028cde9c78b631d4fd97d75625d4912a
MD5 1008c7b52c1b4d8bf64dc64ea43581c8
BLAKE2b-256 25512e7f6afa1e0bd254ff660a6b651fe46ff1fa6b9e21e517479b487d9dad78

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 46c9a7be74af486862bed912fb9aa7586fb32c80afadbd5705af2cdb7fac3e91
MD5 50ac52c9a033d42486df24557b111bac
BLAKE2b-256 3f38f05ecdda2a901a7687ee2b4a83a07706c91b025e66d0a3fbe85ced53344e

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 68ed3e5ee4fa45edd31ffcf821842db37129b9cd4261d28a5637ded549ae8e93
MD5 f965505ecb0897a01b607fcf6e55a523
BLAKE2b-256 5ce1c7273b319de7f5e7156ec18dbbf0da8dfe3063a6108965c43fdb31779120

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b0cf4aeec5bdb588b9b848b1ff0d065bb8f016ce6be76888002458518048309d
MD5 879828343a52cf7bb7424c893f0d8a04
BLAKE2b-256 52a54d418efbd9b3c5b960d48b2f5c264eb96084f7669623448f90796f0f3418

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp312-cp312-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp312-cp312-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 a1f76e8c4a7b12111e2af9ae823ee45c7c287c0a00af1612108b95e4a6d9ecec
MD5 cde1bbfb0c202a73a16c5a2a44caaf25
BLAKE2b-256 1d0e3bdf7ce58172991f6197d006a5a07b43e3d373dfb8896f3e3b913ee133a2

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c17313452e62d5d758a132d6a7097d64e6fb37ba592447cd3a3253ee0953d7ef
MD5 3dba6fc17af16df35f3861e89e4b60c8
BLAKE2b-256 ea202a77711a1e868bd0e4c61dcf57ad5ce5ac3c172673993946571a4eec1d0e

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b86ba5243da87bab2c619d95d0abc9697aa935df0127143463c3299aac2cfe0d
MD5 7b3eafafff71cfa18e1e54b5c01a7a2a
BLAKE2b-256 a2e04eb290a9b0e1b0489ff4bd7ca6bab4d5e5fcb388f1b8a36eee27b12788e9

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 750262d11354b6b15305053e16540e5a27e8ccdf9ddbd68ba27e75e89988733c
MD5 99c9434894d51df82b95788f2cdbd47b
BLAKE2b-256 057b22ac4550cd7d3e925b57cde6542f1a92fdfd92074810f10df66c5381bf11

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp311-cp311-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp311-cp311-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 770edbff335da2d807d63f2eaa7124c41400529003211f6268eb60527fce3921
MD5 c672459ab18ff6667b83ea7d28bc1f3c
BLAKE2b-256 dabb155b154535410e05b545ca46170357cb6524e6d30a468269645489b330b3

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 73349edb0d087f7a865106764a36566df5b3a5495cf4cac6947f1e248e107558
MD5 e9f65cd9753653159283789355a3ac91
BLAKE2b-256 e9e2ba8c9c84037b6e9cfbf66b14e03d25578a66516402e3da7574c84278bafa

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 8d98549ff9e4782a97ed3c29dc3c70c0bcfb499d2eeff2113fc532c64dca4ced
MD5 e1721cc1d34e9ca3f5fa896eec639f3c
BLAKE2b-256 8e6de15fb3404a62492f057e82ccc8dfae37b16faa4873b53a1de7e6ddd53483

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4edd2e559fac84b5560af301503d32ad9ac28c09fb039fc72fdda8eccf647903
MD5 4607b8a14cd73dee11898cd7063500d1
BLAKE2b-256 b2a5eb84669a8276f1486ac97b639632be72674b577ec7519dffbf229728fca6

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp310-cp310-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp310-cp310-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 2e7cf4e88f49ad393b947c3bdda9beecb6f098d332ffc4e772efc984d93c17d7
MD5 79a0d912de8d9fcdf582db357557b98c
BLAKE2b-256 c19efe41fc7a8d94ac2e3659e8fd2c1b699d75c286283b878163023859158178

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 afa0e3ef00bec03bd1c0280aa89fd76e2aebce41df64318b60f830c90d40bf4d
MD5 2716392234c641f5fdae3d53760cc826
BLAKE2b-256 70bdfac9ac1f0271f1d2e8d9334d6759fba66bf4ec18bd53b0cea2311027a5b8

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 83fdd39b5fceca10f2d362b922444ae1f96c9eee9db5a18effb0c164d702cf92
MD5 1f37d7e4cb45b8c1e3e97d1fc3d3cc31
BLAKE2b-256 a7aac634882fabc3bbaefb7f82b83a264c5e50169aba41cbc06c297fbd7cde54

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1eac1ffcd5ff65aac27b88c3cea6988b47dad7cfa76b7a5558e2767f645d526a
MD5 33ec9e6fc9590e6a3b88314f87c2d151
BLAKE2b-256 56fd7879faa8dd760fea712566fd6d378857d9d45d81e1b5e8bb01faccd9c317

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp39-cp39-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp39-cp39-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 8571e3b779fec9a6bb4e5202bf0424c647c10e8ebb3188f6a5f48d8e85235f6e
MD5 3b535fea3cd511992771f477acda6ae3
BLAKE2b-256 88c46573a0b315b277183fff8ffe9963933c0bbfd1326487dd7025abe1ecd134

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1a17f048b4b0fb34ab69a45240f3caaaa207ffabed22393098beb149aaec174d
MD5 eeb767d587e85a5f84232d82b4da7d69
BLAKE2b-256 f6bad2e4fd99c0079dd9e5d901a3d6b290c54c3d12a6e69cda602c2368062e0c

See more details on using hashes here.

File details

Details for the file bingo_nasa-0.5.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.5.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 10626406d3baf332f7b9ead8c79220b2ea69484092f3953f0b7b9b98132d9de6
MD5 e5b5a60c94a702c1cde92d6dbf6c5f87
BLAKE2b-256 148255af7f03d2387c344018d526a2a5b1422d54c406826af16615ef9f50f39a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page