Fix acqusistion function bug when std output by GP is 0.0 #379
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order to calculate the acquisition function EI and PI for a given point x, we will use mean and std output by the gaussian process. However, std may be 0.0(e.g., the gaussian process will set std to 0.0 when we sample a point x that has been sampled before), which will cause an error when calculating EI and PI. In function _ei, when std is 0.0, we can't calculate the EI value using
a * norm.cdf(z) + std * norm.pdf(z)
, instead, we should set the EI value to 0.0. So does function _poi. Therefore, I changed function _ei and _poi to fix this bug.I refer to Acquisition functions in Bayesian Optimization, which discussed the acquisition function in detail and explained the derivation process of PI and EI