3e6b2db90f08a226f751f706ac0f6eb1d487de1b,pgmpy/models/FactorGraph.py,FactorGraph,check_model,#FactorGraph#,166
Before Change
raise ValueError("Factors not associated for all the random"
"variables.")
factor_nodes = set(self.nodes()) - set(variable_nodes)
if len(factor_nodes) != len(self.factors):
raise ValueError("Factors not associated with all the factor nodes.")
cardinalities = self.get_cardinality()
After Change
variable_nodes = set([x for factor in self.factors for x in factor.scope()])
factor_nodes = set(self.nodes()) - variable_nodes
if not all(isinstance(factor_node, Factor) for factor_node in factor_nodes):
raise ValueError("Factors not associated for all the random variables")
if (not (bipartite.is_bipartite(self)) or
not (bipartite.is_bipartite_node_set(self, variable_nodes) or
bipartite.is_bipartite_node_set(self, variable_nodes))):
raise ValueError("Edges can only be between variables and factors")
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances Project Name: pgmpy/pgmpy
Commit Name: 3e6b2db90f08a226f751f706ac0f6eb1d487de1b
Time: 2015-10-19
Author: yashuseth2503@gmail.com
File Name: pgmpy/models/FactorGraph.py
Class Name: FactorGraph
Method Name: check_model
Project Name: pgmpy/pgmpy
Commit Name: ca25da7c55ba436ab557410d5f2e2e9b557d2840
Time: 2015-03-02
Author: abinash.panda.ece10@itbhu.ac.in
File Name: pgmpy/models/MarkovModel.py
Class Name: MarkovModel
Method Name: to_junction_tree
Project Name: pgmpy/pgmpy
Commit Name: 5a53f60e5143ab6f416437dadddd2f1df133a247
Time: 2015-04-07
Author: abinash.panda.ece10@itbhu.ac.in
File Name: pgmpy/models/JunctionTree.py
Class Name: JunctionTree
Method Name: add_edge