Skip to content
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

Error in example of sum product #3

Open
qillbel opened this issue Aug 8, 2018 · 1 comment
Open

Error in example of sum product #3

qillbel opened this issue Aug 8, 2018 · 1 comment

Comments

@qillbel
Copy link

qillbel commented Aug 8, 2018

Dear Author,

I got this error after installing this package. Can you tell me what I need to do?

`TypeError Traceback (most recent call last)
in ()
39 # Perform sum-product algorithm on factor graph
40 # and request belief of variable node x4
---> 41 belief = inference.sum_product(fg, x4)
42
43 # Print belief of variables

~\Downloads\BitBucket\python\FGlib\fglib\inference.py in sum_product(graph, query_node)
61
62 # Sum-Product algorithm is equivalent to Belief Propagation
---> 63 return belief_propagation(graph, query_node)
64
65

~\Downloads\BitBucket\python\FGlib\fglib\inference.py in belief_propagation(graph, query_node)
49
50 # Return marginal distribution
---> 51 return query_node.belief()
52
53

~\Downloads\BitBucket\python\FGlib\fglib\nodes.py in belief(self, normalize)
132
133 # Pick first node
--> 134 n = next(iterator)
135
136 # Product over all incoming messages

TypeError: 'list' object is not an iterator`

@danbar
Copy link
Owner

danbar commented Aug 10, 2018

I tried a fresh install with

$ pip install fglib

and got the following output

$ python3 example_spa
Belief of variable node x4:
[0.49090909 0.50909091]
Belief of variable node x3:
[0.49090909 0.50909091]
Belief of variable node x2:
[0.89090909 0.10909091]
Unnormalized belief of variable node x1:
[0.183 0.147]

Could you provide the output of $ python --version and $ pip list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants