Skip to main content

A toolbox for efficient global optimization

Project description

egobox

tests pytests linting DOI

Rust toolbox for Efficient Global Optimization algorithms inspired from SMT.

egobox is twofold:

  1. for developers: a set of Rust libraries useful to implement bayesian optimization (EGO-like) algorithms,
  2. for end-users: a Python module, the Python binding of the implemented EGO-like optimizer, named Egor and surrogate model Gpx, mixture of Gaussian processes.

The Rust libraries

egobox Rust libraries consists of the following sub-packages.

Name Version Documentation Description
doe crates.io docs sampling methods; contains LHS, FullFactorial, Random methods
gp crates.io docs gaussian process regression; contains Kriging and PLS dimension reduction
moe crates.io docs mixture of experts using GP models
ego crates.io docs efficient global optimization with basic constraints and mixed integer handling

Usage

Depending on the sub-packages you want to use, you have to add following declarations to your Cargo.toml

[dependencies]
egobox-doe = { version = "0.7.0" }
egobox-gp  = { version = "0.7.0" }
egobox-moe = { version = "0.7.0" }
egobox-ego = { version = "0.7.0" }

Features

serializable-gp

The serializable-gp feature enables the serialization of GP models using the serde crate.

persistent-moe

The persistent-moe feature enables save() and load() methods for MoE model to/from a json file using the serde crate.

Examples

Examples (in examples/ sub-packages folder) are run as follows:

$ cd doe && cargo run --example samplings --release
$ cd gp && cargo run --example kriging --release
$ cd moe && cargo run --example clustering --release
$ cd ego && cargo run --example ackley --release

BLAS/LAPACK backend (optional)

egobox relies on linfa project for methods like clustering and dimension reduction, but also try to adopt as far as possible the same coding structures.

As for linfa, the linear algebra routines used in gp, moe ad ego are provided by the pure-Rust linfa-linalg crate, the default linear algebra provider.

Otherwise, you can choose an external BLAS/LAPACK backend available through the ndarray-linalg crate. In this case, you have to specify the blas feature and a linfa BLAS/LAPACK backend feature (more information in linfa features).

Thus, for instance, to use gp with the Intel MKL BLAS/LAPACK backend, you could specify in your Cargo.toml the following features:

[dependencies]
egobox-gp = { version = "0.7.0", features = ["blas", "linfa/intel-mkl-static"] }

or you could run the gp example as follows:

$ cd gp && cargo run --example kriging --release --features blas,linfa/intel-mkl-static

The egobox Python binding

Thanks to the PyO3 project, which makes Rust well suited for building Python extensions. You can install the Python package using:

$ pip install egobox

See the tutorial notebooks for usage of the optimizer and mixture of Gaussian processes surrogate model.

Citation

DOI

If you find this project useful for your research, you may cite it as follows:

@article{
  Lafage2022, 
  author = {Rémi Lafage}, 
  title = {egobox, a Rust toolbox for efficient global optimization}, 
  journal = {Journal of Open Source Software} 
  year = {2022}, 
  doi = {10.21105/joss.04737}, 
  url = {https://doi.org/10.21105/joss.04737}, 
  publisher = {The Open Journal}, 
  volume = {7}, 
  number = {78}, 
  pages = {4737}, 
} 

Additionally, you may consider adding a star to the repository. This positive feedback improves the visibility of the project.

History

I started this library as a way to learn Rust and see if it can be used to implement algorithms like those in the SMT toolbox[^1]. As the first components (doe, gp) emerged, it appears I could translate Python code almost line by line in Rust (well... after a great deal of borrow-checker fight!) and thanks to Rust ndarray library ecosystem.

This library relies also on the linfa project which aims at being the "scikit-learn-like ML library for Rust". Along the way I could contribute to linfa by porting gaussian mixture model (linfa-clustering/gmm) and partial least square family methods (linfa-pls) confirming the fact that Python algorithms translation in Rust could be pretty straightforward.

While I did not benchmark exactly my Rust code against SMT Python one, from my debugging sessions, I noticed I did not get such a great speed up. Actually, algorithms like doe and gp relies extensively on linear algebra and Python famous libraries numpy/scipy which are strongly optimized by calling C or Fortran compiled code.

My guess at this point was that interest could come from some Rust algorithms built upon these initial building blocks hence I started to implement mixture of experts algorithm (moe) and on top surrogate-based optimization EGO algorithm (ego) which gives its name to the library[^2][^3]. Aside from performance, such library can also take advantage from the others Rust selling points.

[^1]: M. A. Bouhlel and J. T. Hwang and N. Bartoli and R. Lafage and J. Morlier and J. R. R. A. Martins. A Python surrogate modeling framework with derivatives. Advances in Engineering Software, 2019.

[^2]: Bartoli, Nathalie, et al. "Adaptive modeling strategy for constrained global optimization with application to aerodynamic wing design." Aerospace Science and technology 90 (2019): 85-102.

[^3]: Dubreuil, Sylvain, et al. "Towards an efficient global multidisciplinary design optimization algorithm." Structural and Multidisciplinary Optimization 62.4 (2020): 1739-1765.

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

egobox-0.7.0.tar.gz (451.0 kB view details)

Uploaded Source

Built Distributions

egobox-0.7.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

egobox-0.7.0-cp310-none-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.10 Windows x86-64

egobox-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

egobox-0.7.0-cp39-none-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.9 Windows x86-64

egobox-0.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

egobox-0.7.0-cp38-none-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.8 Windows x86-64

egobox-0.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

egobox-0.7.0-cp37-none-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.7 Windows x86-64

egobox-0.7.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

File details

Details for the file egobox-0.7.0.tar.gz.

File metadata

  • Download URL: egobox-0.7.0.tar.gz
  • Upload date:
  • Size: 451.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.5

File hashes

Hashes for egobox-0.7.0.tar.gz
Algorithm Hash digest
SHA256 5992b56f07ebc874b61e8b58c87a6c403285507bdfffaafacd76ad7b2e3f9b8d
MD5 bbc33c58700273b650d64bee67dfd5e3
BLAKE2b-256 ca43bf550689513e97a3b55a4f5de9839a1bbfcfbf5100dbb692c91320eb747b

See more details on using hashes here.

File details

Details for the file egobox-0.7.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for egobox-0.7.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 29c020d5303b5174780453c9b7df8960a823b12fd27d695106656cfa8778b3af
MD5 bfeb4ba1ecad47f714b8761a7671824c
BLAKE2b-256 68e5063012401f5a06ff5674f1d2926908c37ff41fa8e57a5730cd5e54cd82ef

See more details on using hashes here.

File details

Details for the file egobox-0.7.0-cp310-none-win_amd64.whl.

File metadata

  • Download URL: egobox-0.7.0-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 5.2 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.5

File hashes

Hashes for egobox-0.7.0-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 c238226353a01eb188930d2306395f466539097245bf2ee3a9ee9bb1d5ee4d8b
MD5 e76a85de72798b158db19853e77d020e
BLAKE2b-256 4c827c1afae91ad3458f24e450dab98d2b6cf083eea430f60e2923a9898b0033

See more details on using hashes here.

File details

Details for the file egobox-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for egobox-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea5cc655b333c5ba3f43fdfd2e2b33babedfe9446841126d47c90edbb319eedb
MD5 907902a57f36c62f06326be08ed08771
BLAKE2b-256 339b41d754246fb4b92b6f52b43089234fdd4acc078c4c64d31867f6c3591949

See more details on using hashes here.

File details

Details for the file egobox-0.7.0-cp39-none-win_amd64.whl.

File metadata

  • Download URL: egobox-0.7.0-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 5.2 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.5

File hashes

Hashes for egobox-0.7.0-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 d3020649bdebe025082d17bea62f4063fcda31f5411ca309872c4f2216680ecf
MD5 7d928572c975b884a94d7fb5bbc5ce68
BLAKE2b-256 6dc7ae0ce427dc666d63c483853aee62498823d3fe9620e478c914d3eba4d08e

See more details on using hashes here.

File details

Details for the file egobox-0.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for egobox-0.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4dfd5ac04dbbf922b379597a5748461f9348b96434e425d0de011b0fef66cd84
MD5 a1bbcc40cee7f456610f8e1695ff73f6
BLAKE2b-256 d70df103b68b1734dc60d3092db8b3cf6f6571c58dc5fa23c73aa740661cc10e

See more details on using hashes here.

File details

Details for the file egobox-0.7.0-cp38-none-win_amd64.whl.

File metadata

  • Download URL: egobox-0.7.0-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 5.2 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.5

File hashes

Hashes for egobox-0.7.0-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 23ec5cdd385171e2a7a0763e577a945fd72079f7eb48bf8335f8805ab6ce1f2d
MD5 d1fbedf64e35b4b8b3d6585e5a608600
BLAKE2b-256 ef31b76085dcd8dfd76ee95e85fa17bf98e2ed8ec4133e224c24292e458a044e

See more details on using hashes here.

File details

Details for the file egobox-0.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for egobox-0.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5abaa0b59142debda851639b71b558f2f9b214462077f2b82fdee05eed56842c
MD5 034e501328286bf28912c27e9575d8b0
BLAKE2b-256 35c47117deeb8693ad8ccde1fe11b54af2e71e5e25bddec5d542e501a92d27eb

See more details on using hashes here.

File details

Details for the file egobox-0.7.0-cp37-none-win_amd64.whl.

File metadata

  • Download URL: egobox-0.7.0-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 5.2 MB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.5

File hashes

Hashes for egobox-0.7.0-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 3dee4f9ba3d4bac58e860b2f9bd18402ecd001fe7be2f3fa94f0779b7a1a1561
MD5 704d8edfaaa52ce89b3a820d02def3cd
BLAKE2b-256 81937ed882253736680304bbb2945cdd23d8a78f04ecab9e521dea2ec11ecabb

See more details on using hashes here.

File details

Details for the file egobox-0.7.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for egobox-0.7.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5ecbc054de2cda7607e75a429494d473e4aab967235ff511f1ccd7176bb5a6d6
MD5 8f3d58e3bd6ecab589f03c3312a03e08
BLAKE2b-256 0024bd556917178d24b63ae4ec961046dd1a8ce75353957a957e36225a0037da

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