Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bayesian Optimisation to AB testing example #1250

Merged
merged 19 commits into from
Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
GP uses right loss
  • Loading branch information
Adam Foster committed Jul 25, 2018
commit b7d76ef0454ad35c91a52574737464274b7ce9c3
2 changes: 1 addition & 1 deletion examples/contrib/oed/ab_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def true_ape(ns):
gpmodel = gp.models.GPRegression(
X, y, gp.kernels.Matern52(input_dim=1, lengthscale=torch.tensor(5.)),
noise=torch.tensor(0.1), jitter=1e-6)
gpmodel.optimize()
gpmodel.optimize(loss=TraceEnum_ELBO(strict_enumeration_warning=False).differentiable_loss)
gpbo = GPBayesOptimizer(constraints.interval(0, 100), gpmodel,
num_acquisitions=num_acquisitions)
for i in range(num_bo_steps):
Expand Down
3 changes: 2 additions & 1 deletion examples/contrib/oed/gp_bayes_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from torch.distributions import transform_to

import pyro
from pyro.infer import TraceEnum_ELBO


class GPBayesOptimizer(pyro.optim.multi.MultiOptimizer):
Expand Down Expand Up @@ -32,7 +33,7 @@ def update_posterior(self, X, y):
X = torch.cat([self.gpmodel.X, X])
y = torch.cat([self.gpmodel.y, y])
self.gpmodel.set_data(X, y)
self.gpmodel.optimize()
self.gpmodel.optimize(loss=TraceEnum_ELBO(strict_enumeration_warning=False).differentiable_loss)

def find_a_candidate(self, differentiable, x_init):
"""Given a starting point, `x_init`, takes one LBFGS step
Expand Down