Follow the steps below to reproduce the main results from our paper.
Run data_generator.py to generate the synthetic dataset.
- Configuration: Modify
config/data_gen.yamlto change tunable parameters such as the number of incidents, variables, and states. - Internally, this script calls
graph_gen.py, which generates individual graph structures usingconfig/graph_gen.yaml.
Before running RCG(CPDAG), we need to learn the true CPDAG:
- Use
learn_kess_g.pywithk = -1to learn the ground truth CPDAG. - You may specify multiple values of
kto generate differentk-essential graphs. - Use
learn_prior.yamlfor configuration.
Important parameters in learn_kess_g.py:
k: Value fork-PC (-1for CPDAG and any positive value as the paramterkfork-PC).ORACLE: Whether to use d-separation (oracle) or data-based CI tests.
Run compare_rcd.py to execute RCG and other baselines:
- Experiment types:
- Vary the number of nodes and evaluate top-$l$ accuracy (see Figure 4(a)).
- Vary the number of anomalous samples and evaluate top-1 accuracy (see Figure 4(b)).
Use the --exp flag to switch between experiment types. Possible values are 1 and 2.
- Baselines: To select or modify the set of baselines, edit the
BASELINESlist incompare_rcd.py.
Visualize experiment results using plot_exp.py.
- Use the
--pathargument to provide the output directory generated bycompare_rcd.py. - Use the same
--expvalue as in the previous step to select the correct plot.
To facilitate reproducibility, we have included the dataset used in our paper. It is available in the UAI-25-dataset directory.
To reproduce the results shown in the paper, run the following commands:
# Reproduce results for Figure 4(a)
python3 compare_rcd.py --path UAI-25-dataset --exp 1
python3 plot_exp.py --path UAI-25-dataset/exp_results/{PATH} --exp 1
# Reproduce results for Figure 4(b)
python3 compare_rcd.py --path UAI-25-dataset --exp 2
python3 plot_exp.py --path UAI-25-dataset/exp_results/{PATH} --exp 2Replace {PATH} with the specific subdirectory created during the experiment run.
The final plots used in the paper can be found in UAI-25-dataset/exp_results/nodes and UAI-25-dataset/exp_results/int-samples.
| File / Folder | Description |
|---|---|
graph_gen.py |
Generates a single graph (incident) using config/graph_gen.yaml. |
data_generator.py |
Generates the full dataset by calling graph_gen.py multiple times. Configured via config/data_gen.yaml. |
learn_kess_g.py |
Learns the k-essential or CPDAG graph from an incident. |
para_kpc/ |
Parallel implementation of k-PC using multiprocessing. |
learn_prior.py |
Learn the k-essential or CPDAG graph for a dataset. |
m_igs.py |
Implementation of M-IGS. |
rcg.py |
Implementation of RCG. |
compare_rcd.py |
Runs multiple baselines on a given dataset and stores the result. |
plot_exp.py |
Plots the results generated by compare_rcd.py. |
- CI Tests: We use chi-square (
chisq) as the default CI test, which is suitable for discrete data. - Discretization: For real-world datasets (e.g., Sock-shop), discretize continuous data using the
BINSparameter. - Preprocessing: Use the
PRE_PROCESSflag to remove irrelevant columns like timestamps or constant-value features. Look for function_select_colsanddiscretizeinbase_utils.pyfor more information. - Parallelism: Most scripts support parallel execution via
THREADINGandWORKERSparameters.