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

Implement BivariateNormal distribution #99

Open
fritzo opened this issue Jan 19, 2018 · 4 comments
Open

Implement BivariateNormal distribution #99

fritzo opened this issue Jan 19, 2018 · 4 comments
Assignees

Comments

@fritzo
Copy link

fritzo commented Jan 19, 2018

I think it would help to have a BivariateNormal distribution. The MultivariateNormal #52 is currently blocked in lack of batched/differentiable linear algebra operations, but for bivariate normals, it's simple to write the cholesky factorizations and inverses out by hand. This would also serve as a great reference implementation as we test the MultivariateNormal once that is implemented. Here is an example implementation I wrote in Pyro (but the batching and shaping are different, so this will take some reworking for use in PyTorch): https://github.com/uber/pyro/blob/8f2f858/pyro/distributions/testing/bivariate_normal.py#L14

@tbrx tbrx self-assigned this Jan 25, 2018
tbrx added a commit that referenced this issue Jan 25, 2018
…oal is for this to fully support batching of covariance matrices, etc.
@fritzo
Copy link
Author

fritzo commented Jan 26, 2018

👍 Thanks @tbrx for starting this. In Pyro, I found bugs in our MultivariateNormal gradients only by hand-implementing a BivariateNormal.

@tbrx
Copy link
Collaborator

tbrx commented Jan 26, 2018

Is the plan to send this upstream (i.e. is a BivariateNormal independently of interest even if we were to have a fully functional MultivariateNormal)? Or is this intended primarily as (a) stopgap and (b) test target?

@fritzo
Copy link
Author

fritzo commented Jan 26, 2018

I'm a bit worried that PyTorch 0.4 might miss some features of MultivariateNormal (batching, gradients, cuda support for trtrs). If there's a risk of these features not making it into release, I think it's a good idea to send this upstream. Certainly it will be valuable in testing, so @apaszke may approve it simply for testing purposes (it will help test PyTorch linear algebra, incidentally).

@apaszke
Copy link

apaszke commented Jan 26, 2018

Maybe we could implement MultivariateNormal that fails if it's not equivalent to BivariateNormal, and later remove this restriction?

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

3 participants