Skip to content

Commit 6a18884

Browse files
SPOT Examples updated
1 parent baf96ea commit 6a18884

5 files changed

Lines changed: 189 additions & 74 deletions

File tree

docs/examples.md

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,61 @@
22

33
## Simple spotPython run
44

5-
```python
5+
```{python}
66
import numpy as np
7-
from math import inf
8-
from spotPython.fun.objectivefunctions import analytical
97
from spotPython.spot import spot
10-
# number of initial points:
11-
ni = 7
12-
# number of points
13-
n = 10
14-
15-
fun = analytical().fun_sphere
16-
lower = np.array([-1])
17-
upper = np.array([1])
18-
design_control={"init_size": ni}
19-
20-
spot_1 = spot.Spot(fun=fun,
21-
lower = lower,
22-
upper= upper,
23-
fun_evals = n,
24-
show_progress=True,
25-
design_control=design_control,)
26-
spot_1.run()
8+
from spotPython.fun.objectivefunctions import analytical
9+
from spotPython.utils.init import fun_control_init, design_control_init, surrogate_control_init
10+
11+
fun = analytical().fun_branin
12+
fun_control = fun_control_init(lower = np.array([-5, 0]),
13+
upper = np.array([10, 15]),
14+
fun_evals=20)
15+
design_control = design_control_init(init_size=10)
16+
surrogate_control = surrogate_control_init(n_theta=2)
17+
S = spot.Spot(fun=fun, fun_control=fun_control, design_control=design_control)
18+
S.run()
19+
```
20+
21+
```raw
22+
spotPython tuning: 3.146824136952164 [######----] 55.00%
23+
spotPython tuning: 3.146824136952164 [######----] 60.00%
24+
spotPython tuning: 3.146824136952164 [######----] 65.00%
25+
spotPython tuning: 3.146824136952164 [#######---] 70.00%
26+
spotPython tuning: 1.1487233101571483 [########--] 75.00%
27+
spotPython tuning: 1.0236891516766402 [########--] 80.00%
28+
spotPython tuning: 0.41994270072214057 [########--] 85.00%
29+
spotPython tuning: 0.40193544341108023 [#########-] 90.00%
30+
spotPython tuning: 0.3991519598268951 [##########] 95.00%
31+
spotPython tuning: 0.3991519598268951 [##########] 100.00% Done...
2732
```
2833

34+
35+
```python
36+
S.print_results()
37+
```
38+
39+
```raw
40+
min y: 0.3991519598268951
41+
x0: 3.1546575195040987
42+
x1: 2.285931113926263
43+
```
44+
45+
46+
```{python}
47+
S.plot_progress(log_y=True)
48+
```
49+
50+
![spotPython progress plot](./images/plot-progress.png)
51+
52+
53+
```{python}
54+
S.surrogate.plot()
55+
```
56+
57+
![spotPython surrogate plot](./images/surrogate-plot.png)
58+
59+
2960
## Further Examples
3061

31-
Examples can be found in the Hyperparameter Tuning Cookbook, e.g., [Documentation of the Sequential Parameter Optimization](https://sequential-parameter-optimization.github.io/Hyperparameter-Tuning-Cookbook/99_spot_doc.html).
62+
Examples can be found in the Hyperparameter Tuning Cookbook, e.g., [Documentation of the Sequential Parameter Optimization](https://sequential-parameter-optimization.github.io/Hyperparameter-Tuning-Cookbook/a_04_spot_doc.html).

docs/images/plot-progress.png

11 KB
Loading

docs/images/surrogate-plot.png

120 KB
Loading

notebooks/00_spotPython_tests.ipynb

Lines changed: 136 additions & 52 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.10.15"
10+
version = "0.10.16"
1111
authors = [
1212
{ name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" }
1313
]

0 commit comments

Comments
 (0)