Skip to content

Commit

Permalink
Internal change.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 510569320
  • Loading branch information
emilyfertig authored and copybara-github committed Feb 28, 2023
1 parent 2888c0f commit 13fca22
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions vizier/_src/algorithms/designers/gp/acquisitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from vizier.pyvizier import converters

tfd = tfp.distributions
tfp_bo = tfp.experimental.bayesopt


class AcquisitionFunction(Protocol):
Expand All @@ -49,6 +50,18 @@ def __call__(
return dist.mean() + 1.8 * dist.stddev()


class EI(AcquisitionFunction):

def __call__(
self,
dist: tfd.Distribution,
features: Optional[chex.ArrayTree] = None,
labels: Optional[chex.Array] = None,
) -> chex.Array:
del features
return tfp_bo.acquisition.GaussianProcessExpectedImprovement(dist, labels)()


# TODO: Support discretes and categoricals.
# TODO: Support custom distances.
class TrustRegion:
Expand Down

0 comments on commit 13fca22

Please sign in to comment.