This package implements the adaptive sampling algorithm from the paper "Batch Sequential Minimum Energy Design with Design-Region Adaptation" by Heeyoung Kim et al. (2017), published in Journal of Quality Technology Vol. 49, No. 1, January 2017.

I have used the abbreviation bSMED to refer to this method. The main function provided by this package is the bSMED function, which creates an R6 object that performs the algorithm.

Demonstration on quad_peaks_slant

To demonstrate how this package works we use the bSMED package to find the maximum of the quad_peaks_slant function in two dimensions. The contour plot below shows that there are four peaks (pink areas) with valleys between them. This is a difficult function to optimize since it is not convex and has multiple local optima.

set.seed(0) # 0 for text in here, 3 to get missed peak
quad_peaks_slant <- TestFunctions::add_linear_terms(function(XX) {.2+.015*TestFunctions::add_zoom(TestFunctions::rastrigin, scale_low = c(.4,.4), scale_high = c(.6,.6))(XX)^.9}, coeffs = c(.02,.01))
ContourFunctions::cf(quad_peaks_slant)

We create a bSMED R6 object using bSMED$new and passing in the parameters we want to set.

a <- bSMED::bSMED$new(D=2,func=quad_peaks_slant,
                      obj="func", b=3, nb=5,
                      X0=lhs::maximinLHS(20,2),
                      Xopts=lhs::maximinLHS(500,2),
                      package="GauPro",
                      parallel=FALSE
                      )

First iteration

To run the experiment, we can simply call a$run(). Below we run only the first iteration and plot the results. The first iteration simply runs the X0 points passed in, so there is no decision making. It only evaluates the function at the given points and fits a model to it. The top left plot shows the predicted surface, the top right plot shows the predictive variance of the model. The red circles on the top right plot show the points that are available to be selected but haven't been selected yet. The bottom left plot shows the actual surface, the bottom right plot shows the squared error.

a$run(1, noplot=F)

Second iteration

In the next iteration the points are selected using the bSMED criterion. The new points are identified by the yellow markers in the top two plots. Two points were added at the lower left peak, one at the top right peak. You can see that there are fewer red circles in the top right plot. Those are points that were removed from consideration by the design-region adaptation criterion.

a$run(1)

Third iteration

In the third iteration three points are added near the top right peak.

a$run(1)

Fourth iteration

In the fourth iteration one more is added to the top right peak, and two to the top left peak.

a$run(1)

Fifth iteration

In the fifth, and final, iteration one more is added to the top left peak, and two to the top right peak. We can see that the bottom two peaks have been largely ignored despite being only marginally lower than the top right peak. Below the plot it prints out the best design point it has found, which is an actual function value, and its prediction of where the maximum of the function is. We can see that these are fairly close, which generally should be true if enough candidate points have been given to the model.

a$run(1)


CollinErickson/bSMED documentation built on May 6, 2019, 12:27 p.m.