Skip to content

Commit

Permalink
Doc-only edit to Enable SaasPyroModel to sample from prior (#2471)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2471

Fully Bayesian model fitting without data - necessary for model-based initialization strategies (such ad BALD) which requires ensembled models to work.

Differential Revision: D61228813
  • Loading branch information
Carl Hvarfner authored and facebook-github-bot committed Aug 14, 2024
1 parent f4c2915 commit a8b37c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions botorch/models/fully_bayesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,11 @@ def sample(self) -> None:
mean = self.sample_mean(**tkwargs)
noise = self.sample_noise(**tkwargs)
lengthscale = self.sample_lengthscale(dim=self.ard_num_dims, **tkwargs)
K = matern52_kernel(X=self.train_X, lengthscale=lengthscale)
K = outputscale * K + noise * torch.eye(self.train_X.shape[0], **tkwargs)
if self.train_Y.shape[-2] > 0:
# Do not attempt to sample Y if the data is empty.
# This leads to errors with empty data.
K = matern52_kernel(X=self.train_X, lengthscale=lengthscale)
K = outputscale * K + noise * torch.eye(self.train_X.shape[0], **tkwargs)
pyro.sample(
"Y",
pyro.distributions.MultivariateNormal(
Expand Down

0 comments on commit a8b37c2

Please sign in to comment.