-
Notifications
You must be signed in to change notification settings - Fork 767
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
Sampling test for Hybrid Posterior #1346
Conversation
Can I ask to create a separate PR (to develop) with sampling for hybrid BNs? Seeing that in isolation will be easier to review. |
Also, convert to draft PR? Don’t think we should run CI as long as we don’t target develop |
So a |
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.
Many comments…
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.
Let’s merge
This test checks for correctness of the hybrid posterior using a sampling based approach.
Specifically, given a simple factor graph as below
we compute the posterior
P(x0, m0, x1| z0, z1)
given measurementsz0, z1
.The test, at a high level performs the following steps:
FG
.BN
.BN(x)/FG(x)
equals the same value for all samples.Since we don't have a sample method for the hybrid bayes net, we perform a sampling scheme similar to a mixture model where,
Sample Method Update
Since the linearized factor graph and the eliminated bayes net do not record the noise model, sampling from the Bayes Net throws an error. To overcome this, I've added an optional parameter to the sample method
SharedDiagonal model
, and if the conditional to sample from doesn't have a noise model associated with it, then it will sample from the provided model. This model should be the same one that is provided to the original factor in the Nonlinear/Gaussian Factor Graph, making it a convenient addition.