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

Thread safety and temporary directory #26

Closed aldro61 closed 4 years ago

aldro61 commented 5 years ago

Hi @Diviyan-Kalainathan,

I had some issues using the SID metric in a multiprocessing setting, since all processes were using the same directory name (and deleting it upon completion). I fixed this in SID.

Then I realized that the code was using /tmp instead of fetching the system's default temporary directory using gettempdir(). I modified launch_R_script and PC to use this. I think it's worth it to convert the other functions, since this will facilitate using the CDT on various platforms.

What do you think?

Cheers, Alex

aldro61 commented 5 years ago

Sure, will do!

diviyank commented 4 years ago

Can you just remove the f-string formatting in your cdt/utils/R.py, PC and SID implementations ? So that way I will be able to merge your contribution directly. Thank you!

aldro61 commented 4 years ago

Hey @Diviyan-Kalainathan! Sorry for the delay, I removed the f-strings. Didn't have time to convert the rest of the CDT though.