-
Notifications
You must be signed in to change notification settings - Fork 246
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
Add Wishart distribution. #1779
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tillahoffmann! It is great to have this distribution. I left initial comments below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review, @tillahoffmann!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @tillahoffmann! Just have a comment at the computation of slogdet.
batch_shape, event_shape = loc[:-1], loc[-1:] | ||
for matrix in [covariance_matrix, precision_matrix, scale_tril]: | ||
if matrix is not None: | ||
batch_shape = lax.broadcast_shapes(batch_shape, matrix[:-2]) | ||
event_shape = lax.broadcast_shapes(event_shape, matrix[-1:]) | ||
return batch_shape, event_shape | ||
return batch_shape, event_shape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this indent intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, assert_one_of
ensures that exactly one of the matrices is available, and returning early avoids looping over precision_matrix
and scale_tril
if covariance_matrix
is given, for example. Either with/without the indent should work though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, thanks!
This PR adds the Wishart distribution for covariance matrices. It should probably be rebased and reviewed after #1778 is merged.