Structure Learning¶
- group StructureLearning
Bayesian Network Structure Learning (BNSL) algorithms including
exhaustive_search
simulated_annealing
pc
Functions
-
PDAG exhaustive_search(const DataframeWrapper &df, const ScoreType &score_type, size_t max_parents, double timeout_sec = 300.0)¶
A function to run the exhaustive search with dynamic programming.
- Parameters:
df – A DataframeWrapper object
max_parents – The maximum number of parents for each node
- Returns:
A PDAG object representing the learned structure
-
PDAG pc_edge_parallel(const DataframeWrapper &df, const CITestType &ci_test_type, size_t max_cond_vars, double timeout_sec)¶
A function to run the PC algorithm.
- Parameters:
df – A DataframeWrapper object
ci_test_type – The type of conditional independence test to use
max_cond_vars – The maximum number of conditional variables to consider
- Returns:
A PDAG object
-
PDAG rai_edge_parallel(const DataframeWrapper &df, const CITestType &ci_test_type, size_t max_cond_vars, double timeout_sec)¶
A function to run the RAI (Recursive Autonomy Identification) algorithm.
- Parameters:
df – A DataframeWrapper object
ci_test_type – The type of conditional independence test to use
max_cond_vars – The maximum number of conditional variables to consider
- Returns:
A PDAG object
-
PDAG simulated_annealing(const DataframeWrapper &df, const ScoreType &score_type, size_t max_parents, size_t max_iters = 100000, double init_temp = 1.0, double cooling_rate = 0.9995, uint64_t seed = 0, size_t num_chains = 0, double timeout_sec = 300.0)¶
Score-based multi-chain simulated annealing.
- Parameters:
df – Dataframe containing the data
max_parents – Maximum number of parents for each node
max_iters – Maximum number of iterations for the annealing process
init_temp – Initial temperature for the annealing process
cooling_rate – Cooling rate for the temperature
seed – Random seed for reproducibility
num_chains – Number of parallel chains to run (0 for auto-detect)
- Returns:
Best DAG found during the annealing process