Skip to content

Inference not finishing for bigger graph #13

@ferencbartok

Description

@ferencbartok

I find this library very easy to use, good documentation and code, I could set it up in 15 mins, compared to pomegranate, pgmpy, pymc - which took longer.

For my simple test Bayesian network, the test has passed, and everything is perfect. But when I test for a real-world network join_tree = InferenceController.apply(model) just runs "forever".
What are the limitations of this? The graph consists of 226 nodes and 344 edges. Most nodes have 2 states (0,1), but a few have 3-4 or max 5 states. Is this graph too big for this algorithm or am I doing something wrong?

My testcode:

def create_model(nodes: list[Node]):
    model = Bbn()
    for node in nodes:
        bbn_node = BbnNode(Variable(node.id, node.id, list(range(node.stateCount))), node.probabilities)
        model.add_node(bbn_node)
        if node.parentIds::
            for parent_id in node.parentIds:
                parent = model.get_node(parent_id)
                model.add_edge(Edge(parent, bbn_node, EdgeType.DIRECTED))

    join_tree = InferenceController.apply(model)
    return join_tree

(nodes are topological sorted)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions