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

Cov matrix used instead of precision matrix? #7

Open
Parskatt opened this issue Nov 26, 2020 · 3 comments
Open

Cov matrix used instead of precision matrix? #7

Parskatt opened this issue Nov 26, 2020 · 3 comments

Comments

@Parskatt
Copy link

At:

def gaussians(self):
gaussians = [distributions.MultivariateNormal(mean, F.softplus(inv_std)**2 * torch.eye(self.d).to(self.device))
for mean, inv_std in zip(self.means, self.inv_cov_stds)]
return gaussians

You seem to insert a precision matrix, but reading the documentation:

https://github.com/pytorch/pytorch/blob/8b248af35d43c97d0e437f6f4ff0fbd4da5700c8/torch/distributions/multivariate_normal.py#L119

It seems like if you do not specify the matrix as a precision matrix, it will be assumed to be a covariance matrix (by argument order).

Is this intended?

@izmailovpavel
Copy link
Owner

Hi @Parskatt, thank you for noticing this! I believe you are correct, and this was not intended. Practically, I believe this does not make a difference, but we need to rename the parameter.

@Parskatt
Copy link
Author

Parskatt commented Dec 3, 2020

Yeah, probably it doesn't matter since you initialize inv_std so that the softplus puts it at 1. Maybe its slightly easier to get a singular distribution (i.e. close to zero variance) with the covariance parameterization, don't think it should be too bad though :)

@izmailovpavel
Copy link
Owner

Right :) We are also typically not training these covariance parameters and just keep them fixed at 1. throughout. Definitely a mistake on our side though.

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

2 participants