Commit 8770fa4
Allow for observation noise without mask in ModelListGP (#2735)
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to make BoTorch better.
Help us understand your motivation by explaining why you decided to make this change.
You can learn more about contributing to BoTorch here: https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md
-->
## Motivation
Fixes #2734
### Have you read the [Contributing Guidelines on pull requests](https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md#pull-requests)?
Yes
Pull Request resolved: #2735
Test Plan:
I've added a test to the unit test, in addition, a separate example:
```python
import torch
from botorch.fit import fit_gpytorch_mll
from botorch.models.gp_regression import SingleTaskGP
from botorch.models.model_list_gp_regression import ModelListGP
from botorch.sampling.list_sampler import ListSampler
from botorch.sampling.normal import SobolQMCNormalSampler
from gpytorch.mlls.sum_marginal_log_likelihood import SumMarginalLogLikelihood
model = ModelListGP(
*[SingleTaskGP(train_X=torch.tensor([[0.0], [1.0]]), train_Y=torch.tensor([[0.0], [1.0]])) for _ in range(2)]
)
mll = SumMarginalLogLikelihood(model.likelihood, model)
mll = fit_gpytorch_mll(mll)
sampler = ListSampler(*[SobolQMCNormalSampler(sample_shape=torch.Size([1])) for _ in range(2)])
# Works:
model.fantasize(
torch.tensor([[0.5]]),
sampler=sampler,
observation_noise=torch.tensor([[0.2, 0.2]]),
evaluation_mask=torch.tensor([[1.0, 1.0]], dtype=torch.bool),
)
# Now also works:
model.fantasize(
torch.tensor([[0.5]]),
sampler=sampler,
observation_noise=torch.tensor([[0.2, 0.2]]),
)
```
Reviewed By: esantorella
Differential Revision: D69261331
Pulled By: saitcakmak
fbshipit-source-id: f51ab84144ecfcf1b142ad7b447fc6c56d5182021 parent f413275 commit 8770fa4
File tree
2 files changed
+23
-0
lines changed- botorch/models
- test/models
2 files changed
+23
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
| 664 | + | |
| 665 | + | |
664 | 666 | | |
665 | 667 | | |
666 | 668 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
482 | 503 | | |
483 | 504 | | |
484 | 505 | | |
| |||
0 commit comments