From a30bddf7397d571aefb2c611b6e56d16e265bd94 Mon Sep 17 00:00:00 2001 From: lucasplagwitz Date: Tue, 1 Sep 2020 22:46:19 +0200 Subject: [PATCH] replace sphinx, cover pep8 --- doc/conf.py | 6 ++--- examples/exploration-vs-exploitation.py | 3 ++- examples/interruptible-optimization.py | 32 ++++++++++++------------- examples/store-and-load-results.py | 2 +- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index da28ff28a..3a842424e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -19,9 +19,6 @@ import warnings import os import re -import matplotlib -matplotlib.use('Agg') -import sphinx_gallery from packaging.version import parse # import pkg_resources import sys @@ -29,6 +26,9 @@ sys.path.insert(0, os.path.abspath('sphinxext')) from github_link import make_linkcode_resolve +import matplotlib +matplotlib.use('Agg') +import sphinx_gallery # __version__ = pkg_resources.get_distribution('skopt').version on_rtd = os.environ.get('READTHEDOCS', None) == 'True' diff --git a/examples/exploration-vs-exploitation.py b/examples/exploration-vs-exploitation.py index a4a3d1994..3a0f0b872 100644 --- a/examples/exploration-vs-exploitation.py +++ b/examples/exploration-vs-exploitation.py @@ -49,6 +49,7 @@ noise_level = 0.1 + # Our 1D toy problem, this is the function we are trying to # minimize def objective(x, noise_level=noise_level): @@ -61,7 +62,7 @@ def objective_wo_noise(x): ############################################################################# -opt = Optimizer([(-2.0, 2.0)], "GP", n_initial_points = 3, +opt = Optimizer([(-2.0, 2.0)], "GP", n_initial_points=3, acq_optimizer="sampling") ############################################################################# diff --git a/examples/interruptible-optimization.py b/examples/interruptible-optimization.py index 65e927232..d3ea368e8 100644 --- a/examples/interruptible-optimization.py +++ b/examples/interruptible-optimization.py @@ -63,14 +63,14 @@ def obj_fun(x, noise_level=noise_level): checkpoint_saver = CheckpointSaver("./checkpoint.pkl", compress=9) # keyword arguments will be passed to `skopt.dump` -gp_minimize(obj_fun, # the function to minimize - [(-20.0, 20.0)], # the bounds on each dimension of x - x0=[-20.], # the starting point - acq_func="LCB", # the acquisition function (optional) - n_calls=10, # the number of evaluations of f including at x0 - n_random_starts=3, # the number of random initialization points - callback=[checkpoint_saver], # a list of callbacks including the checkpoint saver - random_state=777); +gp_minimize(obj_fun, # the function to minimize + [(-20.0, 20.0)], # the bounds on each dimension of x + x0=[-20.], # the starting point + acq_func="LCB", # the acquisition function (optional) + n_calls=10, # the number of evaluations of f including at x0 + n_random_starts=3, # the number of random initial points + callback=[checkpoint_saver], # a list of callbacks including the checkpoint saver + random_state=777); ############################################################################# # Now let's assume this did not finish at once but took some long time: you @@ -107,14 +107,14 @@ def obj_fun(x, noise_level=noise_level): y0 = res.func_vals gp_minimize(obj_fun, # the function to minimize - [(-20.0, 20.0)], # the bounds on each dimension of x - x0=x0, # already examined values for x - y0=y0, # observed values for x0 - acq_func="LCB", # the acquisition function (optional) - n_calls=10, # the number of evaluations of f including at x0 - n_random_starts=3, # the number of random initialization points - callback=[checkpoint_saver], - random_state=777); + [(-20.0, 20.0)], # the bounds on each dimension of x + x0=x0, # already examined values for x + y0=y0, # observed values for x0 + acq_func="LCB", # the acquisition function (optional) + n_calls=10, # the number of evaluations of f including at x0 + n_random_starts=3, # the number of random initialization points + callback=[checkpoint_saver], + random_state=777); ############################################################################# # Possible problems diff --git a/examples/store-and-load-results.py b/examples/store-and-load-results.py index 97e491c0e..e2ae4e6d4 100644 --- a/examples/store-and-load-results.py +++ b/examples/store-and-load-results.py @@ -60,7 +60,7 @@ def obj_fun(x, noise_level=noise_level): x0=[0.], # the starting point acq_func="LCB", # the acquisition function (optional) n_calls=15, # the number of evaluations of f including at x0 - n_random_starts=3, # the number of random initialization points + n_random_starts=3, # the number of random initial points random_state=777) #############################################################################