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

CCDr algorithm can't run #106

Open chencjiajy opened 3 years ago

chencjiajy commented 3 years ago

Describe the bug


KeyboardInterrupt Traceback (most recent call last)

in 3 from cdt.data import load_dataset 4 data, graph = load_dataset("sachs") ----> 5 obj = CCDr() 6 output = obj.predict(data) ~/.local/lib/python3.6/site-packages/cdt/causality/graph/CCDr.py in __init__(self, verbose) 87 def __init__(self, verbose=None): 88 """Init the model and its available arguments.""" ---> 89 if not RPackages.sparsebn: 90 raise ImportError("R Package sparsebn is not available.") 91 ~/.local/lib/python3.6/site-packages/cdt/utils/R.py in __getattribute__(self, name) 130 out = object.__getattribute__(self, name) 131 if out is None and not object.__getattribute__(self, 'init'): --> 132 availability = self.check_R_package(name) 133 setattr(self, name, availability) 134 return availability ~/.local/lib/python3.6/site-packages/cdt/utils/R.py in check_R_package(self, package) 145 """ 146 test_package = not bool(launch_R_script(Path("{}/R_templates/test_import.R".format(os.path.dirname(os.path.realpath(__file__)))), --> 147 {"{package}": package}, verbose=True)) 148 return test_package 149 ~/.local/lib/python3.6/site-packages/cdt/utils/R.py in launch_R_script(template, arguments, output_function, verbose, debug) 192 output = subprocess.call([str(rpath), "--vanilla", str(scriptpath)], 193 stdout=subprocess.DEVNULL, --> 194 stderr=subprocess.DEVNULL) 195 except Exception as e: 196 print("R Call errored, is R available ?") /usr/lib/python3.6/subprocess.py in call(timeout, *popenargs, **kwargs) 287 with Popen(*popenargs, **kwargs) as p: 288 try: --> 289 return p.wait(timeout=timeout) 290 except: 291 p.kill() /usr/lib/python3.6/subprocess.py in wait(self, timeout, endtime) 1475 if self.returncode is not None: 1476 break # Another thread waited. -> 1477 (pid, sts) = self._try_wait(0) 1478 # Check the pid and loop as waitpid has been known to 1479 # return 0 even without WNOHANG in odd situations. /usr/lib/python3.6/subprocess.py in _try_wait(self, wait_flags) 1422 """All callers to this function MUST hold self._waitpid_lock.""" 1423 try: -> 1424 (pid, sts) = os.waitpid(self.pid, wait_flags) 1425 except ChildProcessError: 1426 # This happens if SIGCLD is set to be ignored or waiting KeyboardInterrupt:
diviyank commented 3 years ago

Hello,

Thanks for the feedback, have you tried on other, smaller datasets ? This seems like a inherent CCDr issue (internal to the R library).

Best regards, Diviyan

chencjiajy commented 3 years ago

I have tried other datasets, only about 1000 data. It got stucked too