In some optimization problems a precise evaluation of the function to be optimized is either impossible or exceedingly computationally expensive. This package provides algorithms to optimize a function based on noisy evaluations.
Currently the following algorithms are implemented:
- robust pattern search with adaptive sampling
- simultaneous perturbation stochastic approximation
Both algorithms support bound constraints and do not require to explicitely calculate the gradient of the function.
We do not attempt to find global optima -- look at scikit-optimize
for Bayesian optimization algorithms aimed at finding global optima to noisy optimization problems.
For optimizing functions that are not noisy take a look at scipy.optimize
.
Noisyopt is on PyPI so you can install it using pip install noisyopt
.
Alternatively you can install it from source by obtaining the source code from Github and then running python setup.py install
in the main directory. If you install from source, you first need to install numpy
and scipy
if these packages are not already installed.
Find the minimum of the noisy function obj(x)
with noisyopt
:
import numpy as np
from noisyopt import minimizeCompass
def obj(x):
return (x**2).sum() + 0.1*np.random.randn()
bounds = [[-3.0, 3.0], [0.5, 5.0]]
x0 = np.array([-2.0, 2.0])
res = minimizeCompass(obj, bounds=bounds, x0=x0, deltatol=0.1, paired=False)
You can access the documentation online at Read the docs. If you install from source you can generate a local version by running make html
from the doc
directory.
For bug reports and enhancement requests use the Github issue tool, or (even better!) open a pull request with relevant changes. If you have any questions don't hesitate to contact me by email ([email protected]) or Twitter (@andimscience).
You can run the testsuite by running pytest
in the top-level directory.
You are cordially invited to contribute to the further development of noisyopt!