pyrca.graphs.causal package

class pyrca.graphs.causal.PC(config)

Bases: CausalModel

The standard PC algorithm.

config_class

alias of PCConfig

class pyrca.graphs.causal.PCConfig(domain_knowledge_file=None, run_pdag2dag=True, max_num_points=5000000, alpha=0.01)

Bases: CausalModelConfig

The configuration class for the PC algorithm.

Parameters
  • domain_knowledge_file (Optional[str]) – The file path of the domain knowledge file.

  • run_pdag2dag (bool) – Whether to convert a partial DAG to a DAG.

  • max_num_points (int) – The maximum number of data points in causal discovery.

  • alpha (float) – The p-value threshold for independent test.

domain_knowledge_file: str = None
run_pdag2dag: bool = True
max_num_points: int = 5000000
alpha: float = 0.01
class pyrca.graphs.causal.GES(config)

Bases: CausalModel

The greedy equivalence search (GES) algorithm for causal discovery.

config_class

alias of GESConfig

class pyrca.graphs.causal.GESConfig(domain_knowledge_file=None, run_pdag2dag=True, max_num_points=5000000, max_degree=5, penalty_discount=100)

Bases: CausalModelConfig

The configuration class for the GES algorithm.

Parameters
  • domain_knowledge_file (Optional[str]) – The file path of the domain knowledge file.

  • run_pdag2dag (bool) – Whether to convert a partial DAG to a DAG.

  • max_num_points (int) – The maximum number of data points in causal discovery.

  • max_degree (int) – The allowed maximum number of parents when searching the graph.

  • penalty_discount (int) – The penalty discount (a regularization parameter).

domain_knowledge_file: str = None
run_pdag2dag: bool = True
max_num_points: int = 5000000
max_degree: int = 5
penalty_discount: int = 100
class pyrca.graphs.causal.FGES(config)

Bases: CausalModel

The fast greedy equivalence search (FGES) algorithm for causal discovery.

config_class

alias of FGESConfig

causal = None
static initialize()
static finish()
class pyrca.graphs.causal.FGESConfig(domain_knowledge_file=None, run_pdag2dag=True, max_num_points=5000000, max_degree=10, penalty_discount=80, score_id='sem_bic_score')

Bases: CausalModelConfig

The configuration class for the FGES algorithm.

Parameters
  • domain_knowledge_file (Optional[str]) – The file path of the domain knowledge file.

  • max_num_points (int) – The maximum number of data points in causal discovery.

  • max_degree (int) – The allowed maximum number of parents when searching the graph.

  • penalty_discount (int) – The penalty discount (a regularization parameter).

  • score_id (str) – The score function name, e.g., “sem_bic_score”.

domain_knowledge_file: str = None
max_num_points: int = 5000000
max_degree: int = 10
penalty_discount: int = 80
score_id: str = 'sem_bic_score'
class pyrca.graphs.causal.LiNGAM(config)

Bases: CausalModel

The non-gaussian linear causal models (LiNGAM): https://github.com/cdt15/lingam.

config_class

alias of LiNGAMConfig

class pyrca.graphs.causal.LiNGAMConfig(domain_knowledge_file=None, run_pdag2dag=True, max_num_points=5000000, lower_limit=0.1, n_sampling=-1, min_causal_effect=0.01)

Bases: CausalModelConfig

The configuration class for the LiNGAM algorithm.

Parameters
  • domain_knowledge_file (Optional[str]) – The file path of the domain knowledge file.

  • run_pdag2dag (bool) – Whether to convert a partial DAG to a DAG.

  • max_num_points (int) – The maximum number of data points in causal discovery.

  • lower_limit (float) – The lower limit of the causal effect scores for constructing causal graphs.

  • n_sampling (int) – The number of bootstrapping samples (for bootstrapping only). If n_sampling > 0, bootstrapping will be applied.

  • min_causal_effect (float) – The threshold for detecting causal direction (for bootstrapping only).

domain_knowledge_file: str = None
run_pdag2dag: bool = True
max_num_points: int = 5000000
lower_limit: float = 0.1
n_sampling: int = -1
min_causal_effect: float = 0.01