Skip to main content

A toolbox for efficient global optimization

Project description

egobox

tests pytests linting status

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.

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.4.0" }
egobox-gp  = { version = "0.4.0" }
egobox-moe = { version = "0.4.0" }
egobox-ego = { version = "0.4.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.4.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 Python optimizer Egor

Thanks to the PyO3 project, which makes Rust well suited for building Python extensions, the EGO algorithm written in Rust (aka Egor) is binded in Python. You can install the Python package using:

$ pip install egobox

See the tutorial notebook for usage of the optimizer.

Why egobox?

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 is 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.

Cite

If you happen to find this Rust library useful for your research, you can cite this project as follows:

@Misc{egobox,
  author = {Rémi Lafage},
  title = {Egobox: efficient global optimization toolbox in Rust},
  year = {2020--},
  url = "https://github.com/relf/egobox"
}

[^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.5.0.tar.gz (222.7 kB view details)

Uploaded Source

Built Distributions

egobox-0.5.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

egobox-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

egobox-0.5.0-cp39-none-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.9 Windows x86-64

egobox-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

egobox-0.5.0-cp38-none-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.8 Windows x86-64

egobox-0.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

egobox-0.5.0-cp37-none-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.7 Windows x86-64

egobox-0.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

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

File details

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

File metadata

  • Download URL: egobox-0.5.0.tar.gz
  • Upload date:
  • Size: 222.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.12.12

File hashes

Hashes for egobox-0.5.0.tar.gz
Algorithm Hash digest
SHA256 a677dae07509b46eb60a3ba91adb3836f35f9857eee2605413a6c311bb05c1ee
MD5 0ce7bbf8665f09c44a01a5e25cbecd48
BLAKE2b-256 cd6895321dfc51d2f1b91ba518d667a37db150035026be1c05d855fa3a0941c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for egobox-0.5.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5023b9155158e445a67d7ae01c84bb1328c55841f09838eb7cc5c941cecdb95f
MD5 91e742dfb48db72913f537e08f1f3045
BLAKE2b-256 496571cf5ea6844e0b107ece192e3b1baf2d53619d1af0bb4ad3e6fdf90de0b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for egobox-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2fb5a343d497c7257b754b4b87fb471e5415dee1baf3385e97c082615ec37ee2
MD5 8bce7507f95790b240e6a1da0ec12e99
BLAKE2b-256 9342af7a8a5919388fcae1ace1cbcb830c870fc2d24ecdb3cfd38ff39bbb7614

See more details on using hashes here.

File details

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

File metadata

  • Download URL: egobox-0.5.0-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.12.12

File hashes

Hashes for egobox-0.5.0-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 3df010b57a30b1fa0ebee7e45ec2839467d166da69e1829b9e36503fef225904
MD5 a3b26fb1f61a3549c631dae40d85d59d
BLAKE2b-256 2d0ed0e78dd53d5bf0e3fcd041aec996b1515e453a5bed7b36e3450e3b320d3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for egobox-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 23222726923b068ff83d7dbbdaf12bfc99de93430917cab2b3946c522c895102
MD5 423a4d6c7bf156fe08b20935832083e7
BLAKE2b-256 eeb01ee6adcabc1a48810f20eaadefd1b3128453d8b29b4ee37ad02282e5321d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: egobox-0.5.0-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.12.12

File hashes

Hashes for egobox-0.5.0-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 06d7511de73898b91e226d3952ac17b31b802507156769913234dc9ca08836d3
MD5 1b2065f2f61e37b043a477c522c9ea39
BLAKE2b-256 a81a5911490b6f67a0831be805c6ba2930919c25b378e13b3461b2c99b8279ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for egobox-0.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 61efec3b6448c681b17541b044392b7e104e94dd6892fa9b85405e7febabcfc2
MD5 406dcd0c098d10a327e6654e44ca520f
BLAKE2b-256 8f95892aa9cbdf47cfea980b14a820b8a282d62fe22efaa0d70ee649b561bbd2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: egobox-0.5.0-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.12.12

File hashes

Hashes for egobox-0.5.0-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 d9b8c12fb88a19aa418dce31d93a1a7698a8c3be34c261868d3e268dd24e9f93
MD5 af73567cbb14b8bb4b905cb0ec934f16
BLAKE2b-256 06bc3b76af1db4d09f4b9853129f1a9d9493e908ecf0ab2f8144d8a08445892c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for egobox-0.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 829f7753ae55e61dfc67350d4f27ffc7c9b0ccc10930cf3ad529f819d042d21e
MD5 7a777ac191faf42417e10d2821b9d903
BLAKE2b-256 77621f50407c8656b962aa4606d441911dc8fe72324771cb52eada997b49f856

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