Marginals

115 views
Skip to first unread message

Terranius

unread,
Sep 12, 2015, 1:06:58 AM9/12/15
to opengm
Hello,

I'm fairy new to probabilistic graphical models, and just started looking into loopy belief propagation on some small graphs with the aid of OpenGM. Thanks for this great piece of work!

This might be quite a stupid question but I really need some help to point me in the right direction. After performing the inference, I queried the marginal probabilities, but had no idea how to interprete the output. Should the outputs be probabilities?

I build up a graph in Python and called opengm through the python wrapper. The graph has numVar vertices, and each vertex may take one of two labels. I performed LBP using the following code:

inferBipartite = opengm.inference.BeliefPropagation(gm,parameter=opengm.InfParam(damping=0.01))
inferBipartite.infer()

Then I query the marginals using the following (where numVar=7 is the total number of vertices in the graph):

inferBipartite.marginals(range(numVar))

I got the following numpy array:

Final Marginal:
[[ 0.          0.        ]
 [ 0.82664797  0.        ]
 [ 0.          1.35244174]
 [ 0.          0.        ]
 [ 0.          0.40009358]
 [ 0.          0.33051176]
 [ 0.73773787  0.        ]]

I'm not sure how I should inteprete these results -- since the third row contains a number larger than 1, they don't look like probabilities; moreover, why is there at least one of the two entries in the same row equaling zero?

I think I have already understood the basics of message passing and belief propagation, but there are some fundamental pieces missing from my knowledge base that should bridge my understanding of the theory with opengm. Any comments or pointers will be highly appreciated!

Again, many thanks for this great library!

Jörg Kappes

unread,
Sep 12, 2015, 3:40:37 AM9/12/15
to opengm
Hi,
I guess You currently working on the min-sum-semiring, that means You are minimizing an energy-function (sum).

The marginals are than with respect to this semiring and in this case (pseudo) min-marginals.
That means they approximate the minimal energy of all labelings in which variable n has label l by b_n(l).
These pseudo min marginals are furthermore normalized by subtracting the minimal entry, so they are relative to the overall solution.

Best
Jörg

Terranius

unread,
Sep 18, 2015, 7:59:38 PM9/18/15
to opengm
Hi Jörg,

Thank you very much for your prompt reply! You post was a great pointer into the documentation. I was able to compute the desired marginals with a sum-multiply-semiring.

Best,
Tingran

dingfu...@gmail.com

unread,
May 4, 2017, 9:45:19 PM5/4/17
to opengm
Hi,
   I have a question.How to change from min-sum-semiring to max-sum-semiring(or sum-multiply-semiring).Looking forward to your reply. thank you.
Best,
Ding
Reply all
Reply to author
Forward
0 new messages