99# ' @description
1010# ' Expected Improvement.
1111# '
12+ # ' @section Parameters:
13+ # ' * `"epsilon"` (`numeric(1)`)\cr
14+ # ' \eqn{\epsilon} value used to determine the amount of exploration.
15+ # ' Higher values result in the importance of improvements predicted by the posterior mean
16+ # ' decreasing relative to the importance of potential improvements in regions of high predictive uncertainty.
17+ # ' Defaults to `0` (standard Expected Improvement).
18+ # '
1219# ' @references
1320# ' * `r format_bib("jones_1998")`
1421# '
@@ -60,9 +67,15 @@ AcqFunctionEI = R6Class("AcqFunctionEI",
6067 # ' Creates a new instance of this [R6][R6::R6Class] class.
6168 # '
6269 # ' @param surrogate (`NULL` | [SurrogateLearner]).
63- initialize = function (surrogate = NULL ) {
70+ # ' @param epsilon (`numeric(1)`).
71+ initialize = function (surrogate = NULL , epsilon = 0 ) {
6472 assert_r6(surrogate , " SurrogateLearner" , null.ok = TRUE )
65- super $ initialize(" acq_ei" , surrogate = surrogate , requires_predict_type_se = TRUE , direction = " maximize" , label = " Expected Improvement" , man = " mlr3mbo::mlr_acqfunctions_ei" )
73+ assert_number(epsilon , lower = 0 , finite = TRUE )
74+
75+ constants = ps(epsilon = p_dbl(lower = 0 , default = 0 ))
76+ constants $ values $ epsilon = epsilon
77+
78+ super $ initialize(" acq_ei" , constants = constants , surrogate = surrogate , requires_predict_type_se = TRUE , direction = " maximize" , label = " Expected Improvement" , man = " mlr3mbo::mlr_acqfunctions_ei" )
6679 },
6780
6881 # ' @description
@@ -73,14 +86,16 @@ AcqFunctionEI = R6Class("AcqFunctionEI",
7386 ),
7487
7588 private = list (
76- .fun = function (xdt ) {
89+ .fun = function (xdt , ... ) {
7790 if (is.null(self $ y_best )) {
7891 stop(" $y_best is not set. Missed to call $update()?" )
7992 }
93+ constants = list (... )
94+ epsilon = constants $ epsilon
8095 p = self $ surrogate $ predict(xdt )
8196 mu = p $ mean
8297 se = p $ se
83- d = self $ y_best - self $ surrogate_max_to_min * mu
98+ d = ( self $ y_best - self $ surrogate_max_to_min * mu ) - epsilon
8499 d_norm = d / se
85100 ei = d * pnorm(d_norm ) + se * dnorm(d_norm )
86101 ei = ifelse(se < 1e-20 , 0 , ei )
0 commit comments