Skip to content

[Bug]: Dimensionality of posterior statistics #58

@necrosource-bot

Description

@necrosource-bot

What happened?

Hi, I'm not sure if this is a bug, and if it is, whether it's even possible to fix it without breaking things. But I just noticed that the different posterior statistics one can request from a GPyTorchPosterior have rather inconsistent dimensionality.

Please provide a minimal, reproducible example of the unexpected behavior.

import torch
from botorch.posteriors import GPyTorchPosterior
from gpytorch.distributions import MultivariateNormal

mvn = MultivariateNormal(
    torch.tensor([0.0, 1.0]),
    covariance_matrix=torch.tensor([[1.0, 0.5], [0.5, 1.0]]),
)
posterior = GPyTorchPosterior(mvn)

print("Dim mean: ", posterior.mean.ndim)  # --> 2
print("Dim mode: ", posterior.mode.ndim)  # --> 1
print("Dim variance: ", posterior.variance.ndim)  # --> 2
print("Dim stddev: ", posterior.stddev.ndim)  # --> 1
print("Dim quantile: ", posterior.quantile(torch.tensor(0.5)).ndim)  # --> 2

BoTorch Version

0.14.0

Python Version

3.10

Operating System

macOS

(Optional) Describe any potential fixes you've considered to the issue outlined above.

No response

Pull Request

None

Code of Conduct

  • I agree to follow BoTorch's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions