CCDr algorithm can't run
Describe the bug
- cdt version: '0.5.23'
- python version: 3.6.9
- no Gpu
when I run CCDr algorithm in ipython, it got stucked by hours,the code is snippet in doc:
import networkx as nx
from cdt.causality.graph import CCDr
from cdt.data import load_dataset
data, graph = load_dataset("sachs")
obj = CCCDr()
output = obj.predict(data)
if I use 'ctrl + C' the output is below, it seem RPackages.sparsebn got stucked:
KeyboardInterrupt Traceback (most recent call last)
~/.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:
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
I have tried other datasets, only about 1000 data. It got stucked too