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

Utilities for multivariate gaussians #4

Merged
merged 5 commits into from
Feb 21, 2024
Merged

Utilities for multivariate gaussians #4

merged 5 commits into from
Feb 21, 2024

Conversation

richfitz
Copy link
Member

@richfitz richfitz commented Feb 16, 2024

Some utilities for working with multivariate gaussians:

  • compute the density
  • compute the derivative of the density with respect to the parameters (assuming zero mean)

Currently merging into #1 because it contains those commits due to the support for sampling from a multivariate gaussian

Copy link

codecov bot commented Feb 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3919f38) 100.00% compared to head (421f24d) 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           mrc-5075        #4   +/-   ##
==========================================
  Coverage    100.00%   100.00%           
==========================================
  Files             5         5           
  Lines            88        97    +9     
==========================================
+ Hits             88        97    +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@richfitz richfitz mentioned this pull request Feb 16, 2024
@richfitz richfitz marked this pull request as ready for review February 21, 2024 12:06
Copy link
Contributor

@M-Kusumgar M-Kusumgar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, would be nice if we had a little bit more explanation on the variable names!

R/distributions.R Outdated Show resolved Hide resolved
R/distributions.R Outdated Show resolved Hide resolved
R/distributions.R Outdated Show resolved Hide resolved
set.seed(1)
x <- matrix(rnorm(20, sd = 10), ncol = 2)
expect_equal(apply(x, 1, make_ldmvnorm(vcv)),
mvtnorm::dmvnorm(x, sigma = vcv, log = TRUE))
Copy link
Contributor

@M-Kusumgar M-Kusumgar Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is our implementation of the rmvnorm (mvtnorm exposes the same thing) better? wondering why we implemented that in the distributions file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ours caches the decomposition. Later ours will also be translated into C++

richfitz and others added 2 commits February 21, 2024 16:39
Co-authored-by: M-Kusumgar <98405247+M-Kusumgar@users.noreply.github.com>
Copy link
Contributor

@M-Kusumgar M-Kusumgar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@richfitz richfitz merged commit 432b2aa into mrc-5075 Feb 21, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants