Skip to content

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

@tom4everitt

Description

@tom4everitt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions