CoCalc
Sharedskopt.ipynbOpen in CoCalc
Author: Harald Schilly

Scikit Optimize

Scikit-Optimize, or skopt, is a simple and efficient library to minimize (very) expensive and noisy black-box functions. It implements several methods for sequential model-based optimization. skopt is reusable in many contexts and accessible.

https://scikit-optimize.github.io/

import numpy as np from skopt import gp_minimize def f(x): return ( np.sin(5 * x[0]) * (1 - np.tanh(x[0]**2)) * np.random.randn() * 0.1) res = gp_minimize(f, [(-2.0, 2.0)])
/usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated " /usr/local/lib/python3.6/dist-packages/skopt/optimizer/optimizer.py:399: UserWarning: The objective has been evaluated at this point before. warnings.warn("The objective has been evaluated "
res
WARNING: Some output was deleted.
from skopt.plots import plot_convergence plot_convergence(res)