CoCalc Shared Filesskopt.ipynb
Author: Harald Schilly
Views : 134

# 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/

In [1]:
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 "
In [2]:
res

WARNING: Some output was deleted.
In [3]:
from skopt.plots import plot_convergence

plot_convergence(res)

In [ ]: