You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cannot create an instance of BeliefPropagation from a FactorGraph
AttributeError: module 'networkx' has no attribute 'cliques_containing_node'
The problem appears to be that pgmpy uses an outdated version of networkx in the triangulate method.
Your environment
standard Google colab environment
pgmpy version (0.1.24)
Python version 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Operating System on linux
Steps to reproduce
from pgmpy.inference.ExactInference import BeliefPropagation
def create_factor(i, j, J):
values = [np.exp(J * x_i * x_j) for x_i in [-1, 1] for x_j in [-1, 1]]
return DiscreteFactor(variables=[i, j],
cardinality=[2, 2],
values=values,
state_names={0:[-1,1],1:[-1,1]})
f = dict()
f[(0,1)] = create_factor(0,1,2)
f[(1,2)] = create_factor(1,2,2)
f[(2,3)] = create_factor(2,3,2)
f[(3,0)] = create_factor(3,0,2)
G = FactorGraph()
G.add_nodes_from([0,1,2,3])
G.add_factors(*f.values())
G.add_edges_from([(v, f) for f in f.values() for v in f.variables])
bp = BeliefPropagation(G)
Expected behaviour
The BeliefPropagation object should be correctly created
Actual behaviour
Tell us what happens instead
AttributeError: module 'networkx' has no attribute 'cliques_containing_node'
The text was updated successfully, but these errors were encountered:
Subject of the issue
I cannot create an instance of BeliefPropagation from a FactorGraph
AttributeError: module 'networkx' has no attribute 'cliques_containing_node'
The problem appears to be that pgmpy uses an outdated version of networkx in the triangulate method.
Your environment
standard Google colab environment
Steps to reproduce
Expected behaviour
The BeliefPropagation object should be correctly created
Actual behaviour
Tell us what happens instead
AttributeError: module 'networkx' has no attribute 'cliques_containing_node'
The text was updated successfully, but these errors were encountered: