Giter VIP home page Giter VIP logo

Comments (6)

adam-carruthers avatar adam-carruthers commented on July 28, 2024 1

In the docstring for inference.sum_product it says that the algorithm only works for tree graphs. The algorithm for non-trees is different - try inference.loopy_belief_propagation. However be warned that this algorithm is non-exact, all message-passing algorithms on a loopy graph are non exact!

from fglib.

studentbrad avatar studentbrad commented on July 28, 2024

Thanks for the response.
I tried inference.loopy_belief_propagation. However, I've run into another error.
Is model what I think it is? An arbitrary structured graph?

# Perform loopy-belief propagation on factor graph
# and request belief of variable node x3
belief = inference.loopy_belief_propagation(fg, 10, (x3,))

The terminal output is shown below.

Traceback (most recent call last):
  File "fglib_example.py", line 39, in <module>
    belief = inference.loopy_belief_propagation(fg, 10, (x3,))
  File "/home/bradley/.local/lib/python3.6/site-packages/fglib/inference.py", line 165, in loopy_belief_propagation
    return _schedule(model, 'spa', iterations, query_node, order)
  File "/home/bradley/.local/lib/python3.6/site-packages/fglib/inference.py", line 205, in _schedule
    b[n].append(n.belief(model))
  File "/home/bradley/.local/lib/python3.6/site-packages/fglib/nodes.py", line 140, in belief
    belief *= self.graph[n][self]['object'].get_message(n, self)
TypeError: unsupported operand type(s) for *=: 'NoneType' and 'NoneType'

from fglib.

mercicle avatar mercicle commented on July 28, 2024

@studentbrad did you ever resolve this? I have the same issue for loopy graph when trying to compute marginals

from fglib.

mercicle avatar mercicle commented on July 28, 2024

@goodyguts, for my loopy graph I tried:

score_node_list = [n for (n, attr) in M.nodes(data=True) if attr["type"] == "vn"]
belief = fg_lib.inference.loopy_belief_propagation(M,iterations=100, query_node = score_node_list)

and runs without error, but no marginals. Can you comment please thx!

from fglib.

studentbrad avatar studentbrad commented on July 28, 2024

@mercicle, I wasn't able to get this implementation of loopy belief propagation working.
Of course I appreciate the authors work, but there are other tools for doing the same loopy belief on a structured graph.

from fglib.

Mahdi-Soleymani avatar Mahdi-Soleymani commented on July 28, 2024

@mercicle, I wasn't able to get this implementation of loopy belief propagation working.
Of course I appreciate the authors work, but there are other tools for doing the same loopy belief on a structured graph

Could you please let us know what tool you finally used for the loopy BP? Thanks!

from fglib.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.