Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Bingo Logo

master: Build Status

develop: Build 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

  • Expression-specific symbolic-regression fitting
  • Parallel island evolution strategy implemented with mpi4py
  • Coevolution of fitness predictors

Quick Start

Documentation

Full Documentation Here

Installation

pip install bingo-nasa

Parallel island evolution requires the MPI extra:

pip install "bingo-nasa[MPI]"

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

Configure SymbolicRegressor with its population size, minimum and maximum expression stack sizes, and simplification mode. The estimator uses Expression-native generation, fitting, and loss evaluation. See the migration guide for the current public API. Evolution minimizes loss, while Expression scores are higher-is-better. Legacy AGraph/Equation checkpoints are not compatible with the Expression API.

from bingo.symbolic_regression import SymbolicRegressor
regressor = SymbolicRegressor(
    population_size=100,
    min_stack_size=8,
    max_stack_size=16,
    simplification="cas",
)

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).ravel()
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)

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 .predict(X) to get predictions for X.

pred_y = regressor.predict(X)
pred_y = best_individual.predict(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 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

The source-checkout requirements include MPI support for development and the full test suite. To install only the parallel capability from a package release, use pip install "bingo-nasa[MPI]".

(Optional) Build the C++ expression backend:

./.build_cppagraph.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; from bingo.expressions import AGraphExpression'

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.

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.6.0rc2.tar.gz (398.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

bingo_nasa-0.6.0rc2-cp314-cp314-musllinux_1_2_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

bingo_nasa-0.6.0rc2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (616.7 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

bingo_nasa-0.6.0rc2-cp313-cp313-musllinux_1_2_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

bingo_nasa-0.6.0rc2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (616.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

bingo_nasa-0.6.0rc2-cp312-cp312-musllinux_1_2_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

bingo_nasa-0.6.0rc2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (616.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

bingo_nasa-0.6.0rc2-cp311-cp311-musllinux_1_2_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

bingo_nasa-0.6.0rc2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (613.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file bingo_nasa-0.6.0rc2.tar.gz.

File metadata

  • Download URL: bingo_nasa-0.6.0rc2.tar.gz
  • Upload date:
  • Size: 398.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bingo_nasa-0.6.0rc2.tar.gz
Algorithm Hash digest
SHA256 265ce8ea5f41438c780f0ce42fc008c78a1247b59083d2986eefd2e83615bdf5
MD5 1efe5d5254df5ba09ae98eb7476b1879
BLAKE2b-256 b2ac8434a239872f14d38934b37256bb5ff0e150be44787769f1fffa96ad91b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for bingo_nasa-0.6.0rc2.tar.gz:

Publisher: pypi.yml on nasa/bingo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bingo_nasa-0.6.0rc2-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.6.0rc2-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b815c8fe38b61ec980d71bd37cb23030b903b25c1402725601fbf105484f1dcb
MD5 bed05b8f6453891974f96c459cd1a6e7
BLAKE2b-256 bc1c3d130483f82069b4db816dbe965aa49925fb8591dd6c57adfe875a43a218

See more details on using hashes here.

Provenance

The following attestation bundles were made for bingo_nasa-0.6.0rc2-cp314-cp314-musllinux_1_2_x86_64.whl:

Publisher: pypi.yml on nasa/bingo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bingo_nasa-0.6.0rc2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.6.0rc2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fb38a2418eadf975b0ee18f74a21cccffa4eaf28f70f4b052d8060bc6e4d56ef
MD5 f2a8ec5ed6459fab117070e250d832f4
BLAKE2b-256 4c3bde71c3acca5a6342ef4e1f5c72cdda8c16af4d090192afd9d0cb4fd7e705

See more details on using hashes here.

Provenance

The following attestation bundles were made for bingo_nasa-0.6.0rc2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on nasa/bingo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bingo_nasa-0.6.0rc2-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.6.0rc2-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5593c408d73729b7a4d47ff0c9773564645f1fe3134d33872fae1e1092e381e0
MD5 b30d2dd9bef3a7d4f401741cd83175a7
BLAKE2b-256 16e2673a6ad2b6113c74611a2e1774e7b4fd0db23ce6553a86cc27b414237f88

See more details on using hashes here.

Provenance

The following attestation bundles were made for bingo_nasa-0.6.0rc2-cp313-cp313-musllinux_1_2_x86_64.whl:

Publisher: pypi.yml on nasa/bingo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bingo_nasa-0.6.0rc2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.6.0rc2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cd93f12a0603f6cfb0972d1d61b4c5e01b06770cc64d796ba238951c4087bc9b
MD5 fc86779029731709f5e1eb064aa10618
BLAKE2b-256 ba644080cad30939ddd4ffba8602bcf6abcfa5a11ae19c5ca259804547d9b61b

See more details on using hashes here.

Provenance

The following attestation bundles were made for bingo_nasa-0.6.0rc2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on nasa/bingo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bingo_nasa-0.6.0rc2-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.6.0rc2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 82f9d1317e83ad1f46da20951ed526fe826292d98835b703802ec2bdc1ae2f01
MD5 c6ccdf3787a506cce1a6a294b2d9ce44
BLAKE2b-256 a7bbe58c4d06eda42884c44422702bd642a2d07c01315da7390a0b1612a097e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bingo_nasa-0.6.0rc2-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: pypi.yml on nasa/bingo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bingo_nasa-0.6.0rc2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.6.0rc2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 82486a24af2763af302c900038b6ad21fc79451e6747e9bf37b416deebb1f036
MD5 05b7dd9b87ee3873fdd93f2b4cd9235e
BLAKE2b-256 d0adb6ef81a246652e11a377b9c340536e3847ec592c229f2e05dadada0126ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for bingo_nasa-0.6.0rc2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on nasa/bingo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bingo_nasa-0.6.0rc2-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.6.0rc2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ca9b9b8a109f75ad3e475caa37e16a177e4f4606191c59668e439939624cfd87
MD5 8aab609098d6933b7e18374f7b9994b9
BLAKE2b-256 5f7a8f76ba249dc71dc70aaadb6c08c8dae7db568093713a57485983011d602f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bingo_nasa-0.6.0rc2-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: pypi.yml on nasa/bingo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bingo_nasa-0.6.0rc2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for bingo_nasa-0.6.0rc2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d7a874958b1b85408f19ebd0212baa096739c0ef00af11f8dfa8853a4d1d2a12
MD5 6673423b66303e4b38a5e84bbfb93c54
BLAKE2b-256 2f3c39947fe12a5ca17248748e84a20e3d1597ef83b1db1b252e4f30674e9832

See more details on using hashes here.

Provenance

The following attestation bundles were made for bingo_nasa-0.6.0rc2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on nasa/bingo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.6.0rc2 This release

9 files

0.5.7

11 files

0.5.6

11 files

0.5.5

21 files

0.5.4

21 files

0.5.2

21 files

0.5.1

21 files

0.5.0

21 files

0.4.1

1 file

0.4.0

1 file

0.3.1

1 file

0.3.0

1 file

0.2.2

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page