def _get_eis(self, points, score_optimum):
"""
Calculate the expected improvements for all points.
Parameters
----------
points: list
List of parameter settings for the GP to predict on
score_optimum: float
The score optimum value to use for calculating the difference against the expected value
Returns
-------
Returns the Expected Improvement
"""
# Predict mu's and sigmas for each point
mu, sigma = self.score_regressor.predict(points, return_std=True)
# Subtract each item in list by score_optimum
# We subtract 0.01 because http://haikufactory.com/files/bayopt.pdf
# (2.3.2 Exploration-exploitation trade-of)
diff = mu - (score_optimum - 0.01)
# Divide each diff by each sigma
Z = diff / sigma
# Calculate EI's
ei = diff * norm.cdf(Z) + sigma * norm.pdf(Z)
# Make EI zero when sigma is zero (but then -1 when sigma <= 1e-05 to be more sure that everything goes well)
for index, value in enumerate(sigma):
if value <= 1e-05:
ei[index] = -1
return ei
评论列表
文章目录