fglib
fglib copied to clipboard
Error in example of sum product
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)
~\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`
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
?