Skip to content

Commit f342d93

Browse files
Corrected results in Simple Example
1 parent a83dfb7 commit f342d93

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,12 @@ library(ParBayesianOptimization)
186186

187187
FUN <- function(x) list(Score = simpleFunction(x))
188188

189-
set.seed(0)
189+
set.seed(6)
190190
optObjSimp <- bayesOpt(
191191
FUN = FUN
192192
, bounds = bounds
193193
, initGrid = initGrid
194194
, iters.n = 2
195-
, gsPoints = 25
196195
)
197196
```
198197

@@ -201,23 +200,23 @@ Let’s see how close the algorithm got to the global maximum:
201200
``` r
202201
getBestPars(optObjSimp)
203202
#> $x
204-
#> [1] 7.110515
203+
#> [1] 6.718184
205204
```
206205

207-
The process is getting pretty close\! We were only about 11% shy of the
206+
The process is getting pretty close\! We were only about 3% shy of the
208207
global optimum:
209208

210209
``` r
211-
simpleFunction(7.023)/simpleFunction(getBestPars(optObjSimp)$x)
212-
#> [1] 1.002635
210+
simpleFunction(getBestPars(optObjSimp)$x)/simpleFunction(7.023)
211+
#> [1] 0.968611
213212
```
214213

215214
Let’s run the process for a little longer:
216215

217216
``` r
218217
optObjSimp <- addIterations(optObjSimp,iters.n=3,verbose=0)
219-
simpleFunction(7.023)/simpleFunction(getBestPars(optObjSimp)$x)
220-
#> [1] 1.002635
218+
simpleFunction(getBestPars(optObjSimp)$x)/simpleFunction(7.023)
219+
#> [1] 0.9958626
221220
```
222221

223222
We have now found an `x` very close to the global optimum.
@@ -316,14 +315,14 @@ to see the results:
316315
``` r
317316
optObj$scoreSummary
318317
#> Epoch Iteration max_depth min_child_weight subsample gpUtility acqOptimum inBounds Elapsed Score nrounds errorMessage
319-
#> 1: 0 1 2 1.670129 0.7880670 NA FALSE TRUE 0.11 0.9777163 2 NA
318+
#> 1: 0 1 2 1.670129 0.7880670 NA FALSE TRUE 0.12 0.9777163 2 NA
320319
#> 2: 0 2 2 14.913213 0.8763154 NA FALSE TRUE 0.28 0.9763760 15 NA
321-
#> 3: 0 3 4 18.833690 0.3403900 NA FALSE TRUE 0.45 0.9931657 18 NA
322-
#> 4: 0 4 4 8.639925 0.5499186 NA FALSE TRUE 0.26 0.9981437 7 NA
320+
#> 3: 0 3 4 18.833690 0.3403900 NA FALSE TRUE 0.46 0.9931657 18 NA
321+
#> 4: 0 4 4 8.639925 0.5499186 NA FALSE TRUE 0.27 0.9981437 7 NA
323322
#> 5: 1 5 4 21.871937 1.0000000 0.5857961 TRUE TRUE 0.14 0.9945933 1 NA
324-
#> 6: 2 6 4 0.000000 0.9439879 0.6668303 TRUE TRUE 0.26 0.9990567 7 NA
323+
#> 6: 2 6 4 0.000000 0.9439879 0.6668303 TRUE TRUE 0.27 0.9990567 7 NA
325324
#> 7: 3 7 5 1.395119 0.7071802 0.2973497 TRUE TRUE 0.23 0.9984577 4 NA
326-
#> 8: 4 8 5 0.000000 0.2500000 0.3221660 TRUE TRUE 0.39 0.9994020 10 NA
325+
#> 8: 4 8 5 0.000000 0.2500000 0.3221660 TRUE TRUE 0.38 0.9994020 10 NA
327326
```
328327

329328
``` r
@@ -382,10 +381,10 @@ optimization steps, versus the 4 performed in the sequential example:
382381
``` r
383382
tWithPar
384383
#> user system elapsed
385-
#> 0.92 0.05 6.61
384+
#> 0.89 0.04 6.82
386385
tNoPar
387386
#> user system elapsed
388-
#> 22.75 2.04 21.78
387+
#> 21.92 2.19 21.47
389388
```
390389

391390
## Sampling Multiple Promising Points at Once

0 commit comments

Comments
 (0)