danbar / fglib

factor graph library
MIT License
65 stars 17 forks source link

Gaussian Nodes returns TypeError: marginalize() got an unexpected keyword argument 'normalize' #4

Closed jdmartin86 closed 5 years ago

jdmartin86 commented 5 years ago

Hello,

When trying the test case (test.txt) with Gaussian variables, I receive the following error

Traceback (most recent call last): File "npbp.py", line 31, in belief = inference.sum_product(fg, x4) File "/home/jdmartin86/.local/lib/python3.5/site-packages/fglib/inference.py", line 63, in sum_product return belief_propagation(graph, query_node) File "/home/jdmartin86/.local/lib/python3.5/site-packages/fglib/inference.py", line 42, in belief_propagation msg = u.spa(v) File "/home/jdmartin86/.local/lib/python3.5/site-packages/fglib/nodes.py", line 271, in spa msg = msg.marginalize(n, normalize=False) TypeError: marginalize() got an unexpected keyword argument 'normalize'

jdmartin86 commented 5 years ago

Suggested edit on line 577 rv.py:
def marginalize(self, *dims, normalize=None):

danbar commented 5 years ago

Thx for the feedback! Your suggested edit looks reasonable. I will try it out and keep you updated.

danbar commented 5 years ago

I pushed f35cbac4bb980d9ae809bd46c53027947235fe9a to master, which should solve the reported issue.