FenTechSolutions / CausalDiscoveryToolbox

Package for causal inference in graphs and in the pairwise settings. Tools for graph structure recovery and dependencies are included.
https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/index.html
MIT License
1.08k stars 198 forks source link

Something is wrong with PC algorithm in CausalDiscoveryToolbox. #136

Closed williamty closed 2 years ago

williamty commented 2 years ago

I used two packages to calculate DAG for the same dataset. But I got two different DAG. Another is using Tetrad. The two DAG are very different, and CDT's is definitely wrong!

diviyank commented 2 years ago

Hello, We are actually using PC directly from the pcalg package, we only put a python wrapper around it. Can you try running directly pcalg in R and compare its results with Tetrad? That would be really helpful, thanks a lot

williamty commented 2 years ago

Yes, that's what I'm going to do next. I'll report the result here later.

williamty commented 2 years ago

I think I know why. The dataset I used is real world data, ,so it's mixed. But I didn't deal with the mixed data before running the PC algorithm in CDT. Meanwhile, Tetrad dealt with the mixed data problem automatically.

diviyank commented 1 year ago

Thanks for the info ! Do you know how Tetrad manages this ?

Best, Diviyan

williamty commented 1 year ago

It separates mixed data by pre-define the discrete data dimensions. Then it used Conditional Gaussian or Degenerated Gaussian algorithm to deal with relationships between continuous and discrete nodes.