Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring: Inherit from pgmpy.DAG instead of BayesianNetwork #56

Open
tom4everitt opened this issue Jan 8, 2022 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@tom4everitt
Copy link
Member

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.

@tom4everitt tom4everitt added the enhancement New feature or request label Jan 8, 2022
@RyanCarey
Copy link
Collaborator

RyanCarey commented Jan 8, 2022

If pgmpy.BN uses an alternative representation, i.e. not CPDs, then I agree that it's weird to inherit from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants