Hi, thank you for open-sourcing this great library, which is very valuable to my project! I was running MPLP approximate inference for a Markov Network and had a key error. My Markov network consists of unary factors (factors over single nodes) and ternary factors (factors over a clique of three nodes). I found the problem is caused by the default setting of tighten_triplet=True in the map_query method. If I set it to False then the algorithm runs to complete.
Your environment
pgmpy version: 0.1.24
Python version: 3.10.13
Operating System: Linux
Steps to reproduce
Tell us how to reproduce this issue. Please provide a minimal reproducible code of
the issue you are facing if possible.
Traceback (most recent call last):
File "/home/congtj/openforge/openforge/mrf_inference_mplp.py", line 164, in
results = mplp.map_query(tighten_triplet=True)
File "/home/congtj/miniconda3/envs/openforge/lib/python3.10/site-packages/pgmpy/inference/mplp.py", line 580, in map_query
self._tighten_triplet(max_iterations, later_iter, max_triplets, prolong)
File "/home/congtj/miniconda3/envs/openforge/lib/python3.10/site-packages/pgmpy/inference/mplp.py", line 446, in _tighten_triplet
triplet_scores = self._get_triplet_scores(triangles)
File "/home/congtj/miniconda3/envs/openforge/lib/python3.10/site-packages/pgmpy/inference/mplp.py", line 383, in _get_triplet_scores
[
File "/home/congtj/miniconda3/envs/openforge/lib/python3.10/site-packages/pgmpy/inference/mplp.py", line 384, in
np.amax(self.objective[frozenset(intersect)].values)
KeyError: frozenset({'R_2-14', 'R_10-14'})
I was also wondering if it is possible to plug in evidence to MPLP inference like in query method of Belief Propagation. Thanks!
Subject of the issue
Hi, thank you for open-sourcing this great library, which is very valuable to my project! I was running MPLP approximate inference for a Markov Network and had a key error. My Markov network consists of unary factors (factors over single nodes) and ternary factors (factors over a clique of three nodes). I found the problem is caused by the default setting of tighten_triplet=True in the map_query method. If I set it to False then the algorithm runs to complete.
Your environment
Steps to reproduce
Tell us how to reproduce this issue. Please provide a minimal reproducible code of the issue you are facing if possible.
Expected behaviour
No error.
Actual behavior
Traceback (most recent call last): File "/home/congtj/openforge/openforge/mrf_inference_mplp.py", line 164, in
results = mplp.map_query(tighten_triplet=True)
File "/home/congtj/miniconda3/envs/openforge/lib/python3.10/site-packages/pgmpy/inference/mplp.py", line 580, in map_query
self._tighten_triplet(max_iterations, later_iter, max_triplets, prolong)
File "/home/congtj/miniconda3/envs/openforge/lib/python3.10/site-packages/pgmpy/inference/mplp.py", line 446, in _tighten_triplet
triplet_scores = self._get_triplet_scores(triangles)
File "/home/congtj/miniconda3/envs/openforge/lib/python3.10/site-packages/pgmpy/inference/mplp.py", line 383, in _get_triplet_scores
[
File "/home/congtj/miniconda3/envs/openforge/lib/python3.10/site-packages/pgmpy/inference/mplp.py", line 384, in
np.amax(self.objective[frozenset(intersect)].values)
KeyError: frozenset({'R_2-14', 'R_10-14'})
I was also wondering if it is possible to plug in evidence to MPLP inference like in query method of Belief Propagation. Thanks!