Sobol sampling isn't independent across multiple posteriors #2658
Open
Description
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])
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])
As @saitcakmak pointed out in this discussion, the problem boils down to two sobol sequences produced by draw_sobol_normal_samples
not being independent.
Metadata
Assignees
Labels
No labels