BAMT
BAMT copied to clipboard
scratch of structure learning for discrete bn
This pull request introduces several significant changes to the bamt package, focusing on enhancing the functionality and structure of the checker classes, graph classes, and node models. The most important changes include the creation of new checker classes, updates to the graph structure, and improvements to the node models.
Checker Classes Enhancements:
-
bamt/checkers/base.py: Introduced theCheckerclass, which includes methods for validating arguments and initializing node types. -
bamt/checkers/network_checker.py: Added theNetworkCheckerclass, which extendsCheckerand includes methods for checking network restrictions, validating loads, and determining node types. -
bamt/checkers/node_checkers.py: CreatedRawNodeCheckerandNodeCheckerclasses to handle raw and evolved node types, respectively. These classes include properties for checking node types and validation methods.
Graph Structure Updates:
-
bamt/core/graph/dag.py: Modified theDirectedAcyclicGraphclass to usepgmpyfor directed acyclic graphs, added methods for topological sorting, and removed the oldnetworkxgraph references. -
bamt/core/graph/graph.py: Updated theGraphclass to includenodesandedgesattributes and added a__repr__method for better representation.
Node Models Improvements:
-
bamt/core/node_models/__init__.py: Corrected the import statements to use relative imports for better modularity. -
bamt/core/node_models/distribution.py: Added an abstract__repr__method to theDistributionclass for consistent representation across different distributions. -
bamt/core/node_models/empirical_distribution.py: Implemented the__repr__method in theEmpiricalDistributionclass and added anis_fittedmethod. [1] [2] [3] [4]
Node Classes Adjustments:
-
bamt/core/nodes/__init__.py: Updated import statements to use relative imports for better modularity. -
bamt/core/nodes/child_nodes/child_node.py: Modified theChildNodeclass to accept anameparameter in the constructor. -
bamt/core/nodes/child_nodes/conditional_discrete_node.py: Added a__repr__method and placeholder methods forget_children,get_parents, andfitin theConditionalDiscreteNodeclass. -
bamt/core/nodes/node.py: Updated theNodeclass to includename,disc_parents,cont_parents, andchildrenattributes. -
bamt/core/nodes/root_nodes/continuous_node.py: Corrected the import statement forContinuousDistribution. -
bamt/core/nodes/root_nodes/discrete_node.py: Modified theDiscreteNodeclass to accept anameparameter and updated the__repr__method. -
bamt/core/nodes/root_nodes/root_node.py: Updated theRootNodeclass to accept anameparameter and added a__repr__method.
Additional Changes:
-
bamt/dag_optimizers/dag_optimizer.py: Updated theoptimizemethod signature to acceptdata,scorer, and an optionalformatterparameter.