Skip to content

Commit ccd8ac4

Browse files
0.8.10
1 parent feddc52 commit ccd8ac4

3 files changed

Lines changed: 148 additions & 54 deletions

File tree

notebooks/testKriging.ipynb

Lines changed: 103 additions & 15 deletions
Large diffs are not rendered by default.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "spotPython"
10-
version = "0.8.9"
10+
version = "0.8.10"
1111
authors = [
1212
{ name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" }
1313
]

src/spotPython/spot/spot.py

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -137,44 +137,50 @@ class Spot:
137137
138138
Examples:
139139
>>> import numpy as np
140-
>>> from math import inf
141-
>>> from spotpy.spot_setup import Spot
142-
>>> def objective_function(x):
143-
>>> return x[0]**2 + x[1]**2
144-
>>> lower = np.array([0, 0])
145-
>>> upper = np.array([10, 10])
146-
>>> spot = Spot(fun=objective_function,
147-
>>> lower=lower,
148-
>>> upper=upper,
149-
>>> fun_evals=100,
150-
>>> fun_repeats=1,
151-
>>> max_time=inf,
152-
>>> noise=False,
153-
>>> tolerance_x=0,
154-
>>> ocba_delta=0,
155-
>>> var_type=["num", "num"],
156-
>>> var_name=["x1", "x2"],
157-
>>> infill_criterion="ei",
158-
>>> n_points=10,
159-
>>> seed=123,
160-
>>> log_level=20,
161-
>>> show_models=False,
162-
>>> show_progress=True,
163-
>>> design=None,
164-
>>> design_control={"init_size": 10, "repeats": 1},
165-
>>> surrogate=None,
166-
>>> surrogate_control={"model_optimizer": "differential_evolution",
167-
>>> "model_fun_evals": None,
168-
>>> "min_theta": -3.,
169-
>>> "max_theta": 3.,
170-
>>> "n_theta": 1,
171-
>>> "theta_init_zero": True,
172-
>>> "n_p": 1,
173-
>>> "optim_p": False,
174-
>>> "var_type": ["num", "num"],
175-
>>> "seed": 124,},
176-
>>> optimizer_control={"max_iter": 1000})
177-
>>> spot.run()
140+
from math import inf
141+
from spotPython.spot import spot
142+
def objective_function(X, fun_control=None):
143+
if not isinstance(X, np.ndarray):
144+
X = np.array(X)
145+
if X.shape[1] != 2:
146+
raise Exception
147+
x0 = X[:, 0]
148+
x1 = X[:, 1]
149+
y = x0**2 + 10*x1**2
150+
return y
151+
lower = np.array([0, 0])
152+
upper = np.array([10, 10])
153+
spot = spot.Spot(fun=objective_function,
154+
lower=lower,
155+
upper=upper,
156+
fun_evals=8,
157+
fun_repeats=1,
158+
max_time=inf,
159+
noise=False,
160+
tolerance_x=0,
161+
ocba_delta=0,
162+
var_type=["num", "num"],
163+
infill_criterion="ei",
164+
n_points=1,
165+
seed=123,
166+
log_level=20,
167+
show_models=False,
168+
show_progress=True,
169+
design_control={"init_size": 5, "repeats": 1},
170+
surrogate_control={"model_fun_evals": 1000,
171+
"min_theta": -3.,
172+
"max_theta": 3.,
173+
"n_theta": 2,
174+
"theta_init_zero": True,
175+
"n_p": 1,
176+
"optim_p": False,
177+
"var_type": ["num", "num"],
178+
"seed": 124,},
179+
optimizer_control={"max_iter": 1000})
180+
spot.run()
181+
spot.plot_progress()
182+
spot.plot_contour(i=0, j=1)
183+
spot.plot_importance()
178184
"""
179185

180186
def __str__(self):

0 commit comments

Comments
 (0)