Skip to content

Commit af48b03

Browse files
ben-arnaofmfn
authored andcommitted
minor refactor expected improvement
Minor increase in computational efficiency by only computing the value once instead of twice
1 parent 600d0c7 commit af48b03

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bayes_opt/util.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@ def _ei(x, gp, y_max, xi):
113113
with warnings.catch_warnings():
114114
warnings.simplefilter("ignore")
115115
mean, std = gp.predict(x, return_std=True)
116-
117-
z = (mean - y_max - xi)/std
118-
return (mean - y_max - xi) * norm.cdf(z) + std * norm.pdf(z)
116+
117+
a = (mean - y_max - xi)
118+
z = a / std
119+
return a * norm.cdf(z) + std * norm.pdf(z)
119120

120121
@staticmethod
121122
def _poi(x, gp, y_max, xi):

0 commit comments

Comments
 (0)