Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pablormier/yabox
Yet another black-box optimization library for Python
https://github.com/pablormier/yabox
algorithms black-box black-box-optimization data-science differential-evolution evolutionary-algorithms minimization optimization parallel python python3 stochastic-algorithms
Last synced: 1 day ago
JSON representation
Yet another black-box optimization library for Python
- Host: GitHub
- URL: https://github.com/pablormier/yabox
- Owner: pablormier
- License: apache-2.0
- Created: 2017-07-14T12:57:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T09:07:39.000Z (about 2 years ago)
- Last Synced: 2024-12-24T00:12:29.778Z (8 days ago)
- Topics: algorithms, black-box, black-box-optimization, data-science, differential-evolution, evolutionary-algorithms, minimization, optimization, parallel, python, python3, stochastic-algorithms
- Language: Jupyter Notebook
- Homepage:
- Size: 1.58 MB
- Stars: 137
- Watchers: 5
- Forks: 15
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
#
[![DOI](https://zenodo.org/badge/97233963.svg)](https://zenodo.org/badge/latestdoi/97233963)_Yet another black-box optimization library for Python_
## Description
Yabox is a very small library for black-box (derivative free) optimization of functions that only depends on `numpy` and `matplotlib` for visualization. The library includes different stochastic algorithms for minimizing a function `f(X)` that does not need to have an analytical form, where `X = {x1, ..., xN}`.
The current version of the library includes the Differential Evolution algorithm and a modified version for parallel evaluation.Example of minimization of the Ackley function (using Yabox and Differential Evolution):
![Ackley Function](../master/notebooks/img/ackley.gif?raw=true)
## Installation
Yabox is in PyPI so you can use the following command to install the latest released version:
```bash
pip install yabox
```## Basic usage
### Pre-defined functions
Yabox includes some default benchmark functions used in black-box optimization, available in the package yabox.problems. These functions also include 2D and 3D plotting capabilities:```python
>>> from yabox.problems import Levy
>>> problem = Levy()
>>> problem.plot3d()
```![Levy Function](../master/docs/images/levy.png?raw=true)
A problem is just a function that can be evaluated for a given X:
```python
>>> problem(np.array([1,1,1]))
0.80668910823394901
```### Optimization
Simple example minimizing a function of one variable `x` using Differential Evolution, searching between -10 <= x <= 10:
```python
>>> from yabox import DE
>>> DE(lambda x: sum(x**2), [(-10, 10)]).solve()
(array([ 0.]), 0.0)
```Example using Differential Evolution and showing progress (requires tqdm)
![Optimization example](../master/docs/images/opt_example.gif?raw=true)
Yabox includes a parallel version of Differential Evolution. Import PDE instead of DE:
```python
>>> from yabox import PDE
>>> PDE(lambda x: sum(x**2), [(-10, 10)]).solve()
(array([ 0.]), 0.0)
```**For more examples, check the notebooks included in the project**
## About
This library is inspired in the scipy's differential evolution implementation. The main goal of Yabox is to include a larger set of stochastic black-box optimization algorithms plus many utilities, all in a small library with minimal dependencies.