openbnsllib (pybind11 extension)¶
Base¶
Base submodule
- class openbnsllib.base.ContingencyTable¶
- __init__(self: openbnsllib.base.ContingencyTable, var_ids: list[int], df: openbnsllib.base.DataframeWrapper) None¶
- property cardinalities¶
- property counts¶
- marginalize_to(self: openbnsllib.base.ContingencyTable, var_ids_tgt: list[int]) openbnsllib.base.ContingencyTable¶
- property var_ids¶
- class openbnsllib.base.DataframeWrapper¶
- __init__(self: openbnsllib.base.DataframeWrapper, arg0: object) None¶
- property col_idx2str¶
- property col_str2idx¶
- property data_column_major¶
- property data_row_major¶
- property num_datapoints¶
- property num_values¶
- property num_vars¶
- property val_idx2str¶
- property val_str2idx¶
- class openbnsllib.base.PDAG¶
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: openbnsllib.base.PDAG, arg0: int) -> None
__init__(self: openbnsllib.base.PDAG, arg0: openbnsllib.base.PDAG) -> None
- add_edge(self: openbnsllib.base.PDAG, from: int, to: int) None¶
- has_edge(self: openbnsllib.base.PDAG, from: int, to: int) bool¶
- property num_vars¶
- remove_edge(self: openbnsllib.base.PDAG, from: int, to: int) None¶
- score(self: openbnsllib.base.PDAG, df: openbnsllib.base.DataframeWrapper, score_type: BDeu | K2 | BIC | AIC) float¶
CITest¶
CITests submodule
- class openbnsllib.citest.ChiSquare¶
- __init__(self: openbnsllib.citest.ChiSquare, level: float = 0.05) None¶
- class openbnsllib.citest.GSquare¶
- __init__(self: openbnsllib.citest.GSquare, level: float = 0.05) None¶
- class openbnsllib.citest.OracleGraph¶
- __init__(self: openbnsllib.citest.OracleGraph, pdag: openbnsllib.base.PDAG) None¶
- openbnsllib.citest.citest(x: int, y: int, sepset_candidate: list[int], ct: openbnsllib.base.ContingencyTable, citest_type: openbnsllib.citest.ChiSquare | openbnsllib.citest.GSquare | openbnsllib.citest.OracleGraph) bool¶
Score¶
Score submodule
- class openbnsllib.score.AIC¶
- __init__(self: openbnsllib.score.AIC) None¶
- class openbnsllib.score.BDeu¶
- __init__(self: openbnsllib.score.BDeu, ess: float = 1.0) None¶
- class openbnsllib.score.BIC¶
- __init__(self: openbnsllib.score.BIC) None¶
- class openbnsllib.score.K2¶
- __init__(self: openbnsllib.score.K2) None¶
- openbnsllib.score.calculate_local_score(child_var: int, parent_set: list[int], ct: openbnsllib.base.ContingencyTable, score_type: openbnsllib.score.BDeu | openbnsllib.score.K2 | openbnsllib.score.BIC | openbnsllib.score.AIC) float¶
Structure Learning¶
Structure learning submodule
- openbnsllib.structure_learning.exhaustive_search(df: openbnsllib.base.DataframeWrapper, score_type: openbnsllib.score.BDeu | openbnsllib.score.K2 | openbnsllib.score.BIC | openbnsllib.score.AIC, max_parents: int, timeout_sec: float = 1800.0) openbnsllib.base.PDAG¶
Run exhaustive search algorithm
- openbnsllib.structure_learning.pc_edge_parallel(df: openbnsllib.base.DataframeWrapper, ci_test_type: openbnsllib.citest.ChiSquare | openbnsllib.citest.GSquare | openbnsllib.citest.OracleGraph, max_cond_vars: int, timeout_sec: float = 1800.0) openbnsllib.base.PDAG¶
Run PC algorithm
- openbnsllib.structure_learning.rai_edge_parallel(df: openbnsllib.base.DataframeWrapper, ci_test_type: openbnsllib.citest.ChiSquare | openbnsllib.citest.GSquare | openbnsllib.citest.OracleGraph, max_cond_vars: int, timeout_sec: float = 1800.0) openbnsllib.base.PDAG¶
Run RAI algorithm
- openbnsllib.structure_learning.simulated_annealing(df: openbnsllib.base.DataframeWrapper, score_type: openbnsllib.score.BDeu | openbnsllib.score.K2 | openbnsllib.score.BIC | openbnsllib.score.AIC, max_parents: int, max_iters: int = 10000, init_temp: float = 1.0, cooling_rate: float = 0.9995, seed: int = 0, num_chains: int = 0, timeout_sec: float = 1800.0) openbnsllib.base.PDAG¶
Run simulated annealing algorithm