-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fixes deprecated cluster_bingham.m and bingham_mlesac.m #3
base: master
Are you sure you want to change the base?
Conversation
Notes:
|
This is a bit funny. Looking into this or worst case - wrap the C code. EDIT: tries again. For once c and Matlab return pretty much the same output. Why is this happening?! |
% update the threshold | ||
if logp > pmax | ||
pmax = logp; | ||
end |
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.
Add condition for first iteration
first = 1
if (first || logarithm_p > pmax)
pmax = logarithm_p;
if first
first = 0
else
bing_test = bing_X_combined;
end
end
Hey Ratnesh, two questions:
Thanks for your contribution, btw :). |
Hey, I ll get back to this soon. I stopped using it as I think there's a bug in here. What is weird is something I just found out an hour ago. (Maybe I should create an issue, but I want to affirm I am not making a blunder first) I think there is a bug in It is okay for no_of_samples<100 because look here
If you just sample one at a time, you can escape this (That's what I'll do for n>100 from now on). (Same goes for bingham_mixture_sample.m ) To verify I ran
|
The problem is at L38-43 in
If a< rand() and i > burn_in+1, For the condition on burn_in+1 see #L53 (https://github.com/SebastianRiedel/bingham/blob/master/matlab/bingham_sample_nd.m#L53) I don't know how to correct this rightaway. I ll have to look into the theory behind sampling from Binghams Or maybe, we just need to discard if a<rand() which is not happening. EDIT
But it is not guaranteed if the condition P.S. I am just going by intuition here. Not looking at maths behind. :\ EDIT: So you need a lot of "proposals" - or whatever EDIT: |
One last bug which I forgot to correct. If you fit a BMM to some data, the last component is (generally) a uniform component, which in the C code has eigenvalues :
And the conc params will be `0 0 0' which is fine. Though eigenvalues should be (Or could be any three pure quaternions representing orthogonal axis in 3d, right?)
This can also be seen in https://github.com/SebastianRiedel/bingham/blob/master/matlab/bingham_new_uniform.m
So these lines should be changed in
I don't have a complete understanding of why this happens. (similar samples) Tags @SebastianRiedel @jglov3id for review. |
An issue is now that the samples coming it this way are a bit noisy |
Hi Ratnesh, please use separate issues (in the issue section) for different topics otherwise we lose track of what needs to be fixed and what not. 1.) Regarding the "same samples returned" issue: Afaik there is no easy way to sample from the Bingham distribution directly, that is why in the c-function
Jared implemented a Metropolis-Hastings sampler (https://en.wikipedia.org/wiki/Metropolis%E2%80%93Hastings_algorithm) using a multivariate Gaussian distribution as proposal distirbution for the samples. The fact that sometimes the same samples are returned is part of the algorithm and only this way the samples returned approximate the Bingham distribution. 2). "Regarding sampling from uniform binghams issue:" I can’t reproduce the uniform sampling problem, I played around with bingham_sample.c, printing the bingham distirbution before sampling using.
I got the following, qualitatively identical results.
With all-zero directional vectors:
Of course, all-zero directional vectors should not occur, but in this case (sampling from a uniform distribution) it doesn’t harm either. |
Hi there, trying to contact Sebastian, got confused and ended up writing here which seems not to be right place! If a newbie has some basic questions how is it handled here?! I found several definitions of Bingham distr. in literature and could not figure out how your version related to others. Also some said concentration parameters should be negative and some say positive!! Would be nice to reference a paper or tutorial with basics conforming to your notation. Thanks. |
The library was originally developed by Jared Glover and is based on the conventions in the paper Jared Glover, Leslie Pack Kaelbling, "Tracking 3-D rotations with the quaternion Bingham filter", MIT-CSAIL-TR-2013-005, 2013 It is available at |
Please review.
(I just browsed the deprecated folder today and realized I didn't have to write from scratch..)
Jared's paper with description of BMMs See pg 6, section E