{"id":16896974,"url":"https://github.com/relf/egobox","last_synced_at":"2025-03-15T14:30:33.058Z","repository":{"id":36960995,"uuid":"290715713","full_name":"relf/egobox","owner":"relf","description":"Efficient global optimization toolbox in Rust: bayesian optimization, mixture of gaussian processes, sampling methods ","archived":false,"fork":false,"pushed_at":"2024-04-10T08:13:06.000Z","size":11438,"stargazers_count":47,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-21T08:06:41.960Z","etag":null,"topics":["gaussian-processes","global-optimization","latin-hypercube-sampling","mixture-of-experts","surrogate-models"],"latest_commit_sha":null,"homepage":"https://joss.theoj.org/papers/10.21105/joss.04737","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/relf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-08-27T08:07:45.000Z","updated_at":"2024-04-22T10:56:32.173Z","dependencies_parsed_at":"2023-02-16T05:31:37.624Z","dependency_job_id":"d8092a85-23eb-4436-91b2-9af63cfd05cd","html_url":"https://github.com/relf/egobox","commit_stats":{"total_commits":390,"total_committers":2,"mean_commits":195.0,"dds":0.002564102564102555,"last_synced_commit":"b051d8ec84b1f3a7b11cf1da719e39e9e7617c4c"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relf%2Fegobox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relf%2Fegobox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relf%2Fegobox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relf%2Fegobox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/relf","download_url":"https://codeload.github.com/relf/egobox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243742526,"owners_count":20340663,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gaussian-processes","global-optimization","latin-hypercube-sampling","mixture-of-experts","surrogate-models"],"created_at":"2024-10-13T17:34:15.048Z","updated_at":"2025-03-15T14:30:33.052Z","avatar_url":"https://github.com/relf.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg\n    width=\"100\"\n    src=\"./doc/LOGO_EGOBOX_v4_100x100.png\"\n    alt=\"Efficient Global Optimization toolbox in Rust\"\n  /\u003e\n\u003c/p\u003e\n\n# EGObox - Efficient Global Optimization toolbox\n\n[![tests](https://github.com/relf/egobox/workflows/tests/badge.svg)](https://github.com/relf/egobox/actions?query=workflow%3Atests)\n[![pytests](https://github.com/relf/egobox/workflows/pytest/badge.svg)](https://github.com/relf/egobox/actions?query=workflow%3Apytest)\n[![linting](https://github.com/relf/egobox/workflows/lint/badge.svg)](https://github.com/relf/egobox/actions?query=workflow%3Alint)\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.04737/status.svg)](https://doi.org/10.21105/joss.04737)\n\nRust toolbox for Efficient Global Optimization inspired by [the EGO implementation](https://smt.readthedocs.io/en/stable/_src_docs/applications/ego.html)\nin the [SMT](https://github.com/SMTorg/smt) Python library.\n\nThe `egobox` package is twofold:\n\n1. for end-users: [a Python module](#the-python-module), the Python binding of the optimizer named `Egor` and the surrogate model `Gpx`, mixture of Gaussian processes, written in Rust.\n2. for developers: [a set of Rust libraries](#the-rust-libraries) useful to implement bayesian optimization (EGO-like) algorithms,\n\n## The Python module\n\n### Installation\n\n```bash\npip install egobox\n```\n\n### Egor optimizer\n\n```python\nimport numpy as np\nimport egobox as egx\n\n# Objective function\ndef f_obj(x: np.ndarray) -\u003e np.ndarray:\n    return (x - 3.5) * np.sin((x - 3.5) / (np.pi))\n\n# Minimize f_opt in [0, 25]\nres = egx.Egor(egx.to_specs([[0.0, 25.0]]), seed=42).minimize(f_obj, max_iters=20)\nprint(f\"Optimization f={res.y_opt} at {res.x_opt}\")  # Optimization f=[-15.12510323] at [18.93525454]\n```\n\n### Gpx surrogate model\n\n```python\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport egobox as egx\n\n# Training\nxtrain = np.array([0.0, 1.0, 2.0, 3.0, 4.0])\nytrain = np.array([0.0, 1.0, 1.5, 0.9, 1.0])\ngpx = egx.Gpx.builder().fit(xtrain, ytrain)\n\n# Prediction\nxtest = np.linspace(0, 4, 100).reshape((-1, 1))\nytest = gpx.predict(xtest)\n\n# Plot\nplt.plot(xtest, ytest)\nplt.plot(xtrain, ytrain, \"o\")\nplt.show()\n```\n\nSee the [tutorial notebooks](https://github.com/relf/egobox/tree/master/doc/README.md) and [examples folder](https://github.com/relf/egobox/tree/d9db0248199558f23d966796737d7ffa8f5de589/python/egobox/examples) for more information on the usage of the optimizer and mixture of Gaussian processes surrogate model.\n\n## The Rust libraries\n\n`egobox` Rust libraries consists of the following sub-packages.\n\n| Name                                                  | Version                                                                                         | Documentation                                                               | Description                                                                               |\n| :---------------------------------------------------- | :---------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------- |\n| [doe](https://github.com/relf/egobox/tree/master/doe) | [![crates.io](https://img.shields.io/crates/v/egobox-doe)](https://crates.io/crates/egobox-doe) | [![docs](https://docs.rs/egobox-doe/badge.svg)](https://docs.rs/egobox-doe) | sampling methods; contains LHS, FullFactorial, Random methods                             |\n| [gp](https://github.com/relf/egobox/tree/master/gp)   | [![crates.io](https://img.shields.io/crates/v/egobox-gp)](https://crates.io/crates/egobox-gp)   | [![docs](https://docs.rs/egobox-gp/badge.svg)](https://docs.rs/egobox-gp)   | gaussian process regression; contains Kriging, PLS dimension reduction and sparse methods |\n| [moe](https://github.com/relf/egobox/tree/master/moe) | [![crates.io](https://img.shields.io/crates/v/egobox-moe)](https://crates.io/crates/egobox-moe) | [![docs](https://docs.rs/egobox-moe/badge.svg)](https://docs.rs/egobox-moe) | mixture of experts using GP models                                                        |\n| [ego](https://github.com/relf/egobox/tree/master/ego) | [![crates.io](https://img.shields.io/crates/v/egobox-ego)](https://crates.io/crates/egobox-ego) | [![docs](https://docs.rs/egobox-ego/badge.svg)](https://docs.rs/egobox-ego) | efficient global optimization with constraints and mixed integer handling                 |\n\n### Usage\n\nDepending on the sub-packages you want to use, you have to add following declarations to your `Cargo.toml`\n\n```text\n[dependencies]\negobox-doe = { version = \"0.27\" }\negobox-gp  = { version = \"0.27\" }\negobox-moe = { version = \"0.27\" }\negobox-ego = { version = \"0.27\" }\n```\n\n### Features\n\nThe table below presents the various features available depending on the subcrate\n\n| Name         | doe  | gp   | moe  | ego  |\n| :----------- | :--- | :--- | :--- | :--- |\n| serializable | ✔️    | ✔️    | ✔️    |      |\n| persistent   |      |      | ✔️    | ✔️(*) |\n| blas         |      | ✔️    | ✔️    | ✔️    |\n| nlopt        |      | ✔️    |      | ✔️    |\n\n(*) for persistent mixture of gaussian processes with discrete variable available in `ego`\n\n#### serializable\n\nWhen selected, the serialization with [serde crate](https://serde.rs/) is enabled.\n\n#### persistent\n\nWhen selected, the save and load as a json file with [serde_json crate](https://serde.rs/) is enabled.\n\n#### blas\n\nWhen selected, the usage of BLAS/LAPACK backend is possible, see [below](#blaslapack-backend-optional) for more information.\n\n#### nlopt\n\nWhen selected, the [nlopt crate](https://github.com/adwhit/rust-nlopt) is used to provide optimizer implementations (ie Cobyla, Slsqp)\n\n### Examples\n\nExamples (in `examples/` sub-packages folder) are run as follows:\n\n```bash\ncd doe \u0026\u0026 cargo run --example samplings --release\n```\n\n``` bash\ncd gp \u0026\u0026 cargo run --example kriging --release\n```\n\n``` bash\ncd moe \u0026\u0026 cargo run --example clustering --release\n```\n\n``` bash\ncd ego \u0026\u0026 cargo run --example ackley --release\n```\n\n### BLAS/LAPACK backend (optional)\n\n`egobox` relies on [linfa](https://github.com/rust-ml/linfa) project for methods like clustering and dimension reduction, but also try to adopt as far as possible the same [coding structures](https://github.com/rust-ml/linfa/blob/master/CONTRIBUTE.md).\n\nAs for `linfa`, the linear algebra routines used in `gp`, `moe` ad `ego` are provided by the pure-Rust [linfa-linalg](https://github.com/rust-ml/linfa-linalg) crate, the default linear algebra provider.\n\nOtherwise, you can choose an external BLAS/LAPACK backend available through the [ndarray-linalg](https://github.com/rust-ndarray/ndarray-linalg) crate. In this case, you have to specify the `blas` feature and a `linfa` [BLAS/LAPACK backend feature](https://github.com/rust-ml/linfa#blaslapack-backend) (more information in [linfa features](https://github.com/rust-ml/linfa#blaslapack-backend)).\n\nThus, for instance, to use `gp` with the Intel MKL BLAS/LAPACK backend, you could specify in your `Cargo.toml` the following features:\n\n```text\n[dependencies]\negobox-gp = { version = \"0.27\", features = [\"blas\", \"linfa/intel-mkl-static\"] }\n```\n\nor you could run the `gp` example as follows:\n\n``` bash\ncd gp \u0026\u0026 cargo run --example kriging --release --features blas,linfa/intel-mkl-static\n```\n\n## Citation\n\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.04737/status.svg)](https://doi.org/10.21105/joss.04737)\n\nIf you find this project useful for your research, you may cite it as follows:\n\n```text\n@article{\n  Lafage2022, \n  author = {Rémi Lafage}, \n  title = {egobox, a Rust toolbox for efficient global optimization}, \n  journal = {Journal of Open Source Software} \n  year = {2022}, \n  doi = {10.21105/joss.04737}, \n  url = {https://doi.org/10.21105/joss.04737}, \n  publisher = {The Open Journal}, \n  volume = {7}, \n  number = {78}, \n  pages = {4737}, \n} \n```\n\nAdditionally, you may consider adding a star to the repository. This positive feedback improves the visibility of the project.\n\n## References\n\nBartoli, N., Lefebvre, T., Dubreuil, S., Olivanti, R., Priem, R., Bons, N., Martins, J. R. R. A., \u0026 Morlier, J. (2019).\n[Adaptive modeling strategy for constrained global optimization with application to aerodynamic wing design](https://doi.org/10.1016/j.ast.2019.03.041).\nAerospace Science and Technology, 90, 85–102.\n\nBouhlel, M. A., Bartoli, N., Otsmane, A., \u0026 Morlier, J. (2016).\n[Improving kriging surrogates of high-dimensional design models by partial least squares dimension reduction](https://doi.org/10.1007/s00158-015-1395-9).\nStructural and Multidisciplinary Optimization, 53(5), 935–952.\n\nBouhlel, M. A., Hwang, J. T., Bartoli, N., Lafage, R., Morlier, J., \u0026 Martins, J. R. R. A.\n(2019). [A python surrogate modeling framework with derivatives](https://doi.org/10.1016/j.advengsoft.2019.03.005).\nAdvances in Engineering Software, 102662.\n\nDubreuil, S., Bartoli, N., Gogu, C., \u0026 Lefebvre, T. (2020).\n[Towards an efficient global multi-disciplinary design optimization algorithm](https://doi.org/10.1007/s00158-020-02514-6)\nStructural and Multidisciplinary Optimization, 62(4), 1739–1765.\n\nJones, D. R., Schonlau, M., \u0026 Welch, W. J. (1998).\n[Efficient global optimization of expensive black-box functions. Journal of Global Optimization](https://www.researchgate.net/publication/235709802_Efficient_Global_Optimization_of_Expensive_Black-Box_Functions), 13(4), 455–492.\n\nDiouane, Youssef, et al. [TREGO: a trust-region framework for efficient global optimization](https://arxiv.org/pdf/2101.06808).\nJournal of Global Optimization 86.1 (2023): 1-23.\n\nPriem, Rémy, Nathalie Bartoli, and Youssef Diouane.\n[On the use of upper trust bounds in constrained Bayesian optimization infill criteria](https://hal.science/hal-02182492v1/file/Priem_24049.pdf).\nAIAA aviation 2019 forum. 2019.\n\nSasena M., Papalambros P., Goovaerts P., 2002.\n[Global optimization of problems with disconnected feasible regions via surrogate modeling](https://deepblue.lib.umich.edu/handle/2027.42/77089).\nAIAA Paper.\n\nGinsbourger, D., Le Riche, R., \u0026 Carraro, L. (2010).\n[Kriging is well-suited to parallelize optimization](https://www.researchgate.net/publication/226716412_Kriging_Is_Well-Suited_to_Parallelize_Optimization)\n\nE.C. Garrido-Merchan and D. Hernandez-Lobato.\n[Dealing with categorical and integer-valued variables in Bayesian Optimization with Gaussian processes](https://arxiv.org/pdf/1805.03463).\n\nsmtorg. (2018). [Surrogate modeling toolbox](https://github.com/SMTOrg/smt). GitHub.\n\n## License\n\nLicensed under the Apache License, Version 2.0 \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelf%2Fegobox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frelf%2Fegobox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelf%2Fegobox/lists"}