Letting core.CausalBayesianNetwork inherit from pgmpy.DAG instead of pgmpy.BayesianNetwork would have some benefits.
Philosophically, it's a bit weird to let a Bayesian network inherit from a Bayesian network, as we're currently doing. Essentially, this means that we're trying to maintain two representations of the model (in cbn.cpds and in cbn.model), with extra code complexity to keep them in sync.
Instead, we could just let CausalBayesianNetwork inherit from pgmpy.DAG, and add a method to_pgmpy_bn() which we could use in queries etc. Note that the methods query(), sample() etc are not part of pgmpy.BayesianNetwork, and require the construction of different objects anyway.
Letting core.CausalBayesianNetwork inherit from pgmpy.DAG instead of pgmpy.BayesianNetwork would have some benefits.
Philosophically, it's a bit weird to let a Bayesian network inherit from a Bayesian network, as we're currently doing. Essentially, this means that we're trying to maintain two representations of the model (in cbn.cpds and in cbn.model), with extra code complexity to keep them in sync.
Instead, we could just let CausalBayesianNetwork inherit from pgmpy.DAG, and add a method to_pgmpy_bn() which we could use in queries etc. Note that the methods query(), sample() etc are not part of pgmpy.BayesianNetwork, and require the construction of different objects anyway.