-
Notifications
You must be signed in to change notification settings - Fork 425
Fix von Mises-Fisher sampler #1930
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1930 +/- ##
=======================================
Coverage 86.26% 86.26%
=======================================
Files 146 146
Lines 8765 8769 +4
=======================================
+ Hits 7561 7565 +4
Misses 1204 1204 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Nice work! This is an elegant solution, and I agree that it's preferable to the fix I proposed in #1918. I'm happy to delete that PR if/when this PR is accepted. |
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.
Can't we use the reflector machinery from LinearAlgebra instead of reimplementing it here. I.e. reflector!
and reflectorApply!
. I do realize that I did a poor job documenting the two, but the implementations should be robust and I think we avoid the rotate
field.
Fixes #1423.
As already discussed in #1423, in the special case
mu = [1, 0, ..., 0]
no rotation of the "initial" sample is needed. I think skipping the rotation completely is preferable over a numerical workaround such as #1918.I used the opportunity to also add comments and references to the existing code of the von Mises-Fisher sampler.
Edit: I switched to using
LinearAlgebra.reflector!
andLinearAlgebra.applyReflector!
.