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

Sobol sampling isn't independent across multiple posteriors #2658

Open
pvasu opened this issue Dec 23, 2024 Discussed in #2655 · 0 comments
Open

Sobol sampling isn't independent across multiple posteriors #2658

pvasu opened this issue Dec 23, 2024 Discussed in #2655 · 0 comments

Comments

@pvasu
Copy link

pvasu commented Dec 23, 2024

Discussed in #2655

Originally posted by pvasu December 16, 2024

Sobol sampling doesn't work properly on a PosteriorList: sobol base samples are built separately for each posterior, but they aren't independent.

Here's an example:

import matplotlib.pyplot as plt
import torch
from botorch.posteriors import GPyTorchPosterior, PosteriorList
from gpytorch.distributions.multivariate_normal import MultivariateNormal
from botorch.sampling import get_sampler

mvns = [
    MultivariateNormal(torch.tensor([0.0]), torch.tensor([[1.0]])) for _ in range(2)
]
posterior = PosteriorList(*[GPyTorchPosterior(mvn) for mvn in mvns])

sampler = get_sampler(posterior, torch.Size([512]))
samples = sampler(posterior).squeeze()

plt.scatter(samples[:, 0], samples[:, 1])

image

Whereas in an older version of Botorch, 0.6.6, constructing a Sobol sampler on a posterior list works properly:

from botorch.sampling import SobolQMCNormalSampler

sampler = SobolQMCNormalSampler(512)
samples = sampler(posterior).squeeze()

plt.scatter(samples[:, 0], samples[:, 1])

image

As @saitcakmak pointed out in this discussion, the problem boils down to two sobol sequences produced by draw_sobol_normal_samples not being independent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant