Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCDr algorithm execution error #157

Open
oriAleph opened this issue Jun 13, 2023 · 0 comments
Open

CCDr algorithm execution error #157

oriAleph opened this issue Jun 13, 2023 · 0 comments

Comments

@oriAleph
Copy link

Hello!

I am working on a project comparing various causal discovery algorithms in the Causal Discovery Toolbox (CDT).
I am encountering an error with the CCDr algorithm.

All three data types (hybrid, continuous, and discrete) didn't work. I also changed the temporary directory, which let me visibly see the temporary folder/files being created while it was processing and then immediately deleted. So, I don't think it's an access/permission issue.

Versions:
CDT package - 0.6.0
Python - 3.11.3
Pytorch - 2.0.1
No GPUs available.

You will need the following ->

Data files:
data.csv - hybrid data type
data.csv

data1.csv - continuous data type
data1.csv

data2.csv - discrete data type
data2.csv

The following Python script:

import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
from cdt.causality.graph import CCDr
# from cdt.metrics import precision_recall, SID, SHD

# Load data
file = 'data1.csv'
data = pd.read_csv(file)

# Create and visualize CDT graph
model = CCDr()
prediction = model.predict(data)

pos = nx.spring_layout(prediction)
nx.draw_networkx(prediction, pos, with_labels=True, node_size=300)
plt.show()

Error:
R Python Error Output

[Errno 2] No such file or directory: '/Users/oriana/CDT/CDT_Algorithms/check/cdt_ccdr_f8b6bdf0-3c90-4f35-b860-8abe44173994/result.csv'
Traceback (most recent call last):
File "/Users/oriana/CDT/CDT_Algorithms/check/CCDr.py", line 27, in
prediction = model.predict(data)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cdt/causality/graph/model.py", line 63, in predict
return self.create_graph_from_data(df_data, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cdt/causality/graph/CCDr.py", line 121, in create_graph_from_data
results = self._run_ccdr(data, verbose=self.verbose)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cdt/causality/graph/CCDr.py", line 142, in _run_ccdr
raise e
File "/usr/local/lib/python3.11/site-packages/cdt/causality/graph/CCDr.py", line 137, in _run_ccdr
ccdr_result = launch_R_script(Path("{}/R_templates/CCDr.R".format(os.path.dirname(os.path.realpath(file)))),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cdt/utils/R.py", line 221, in launch_R_script
raise RuntimeError("RProcessError \nR Process Error Output \n-----------------------\n" + str(err, "ISO-8859-1")) from None
RuntimeError: RProcessError
R Process Error Output
Loading required package: sparsebnUtils
Loading required package: ccdrAlgorithm
Loading required package: discretecdAlgorithm

sparsebn v0.1, Copyright (c) 2016-2020
Bryon Aragam, University of Chicago
Jiaying Gu, University of California, Los Angeles
Dacheng Zhang, University of California, Los Angeles
Qing Zhou, University of California, Los Angeles
Fei Fu

Please cite our work! Type citation("sparsebn") for details.
---> Bugs? Please report any bugs at https://github.com/itsrainingdata/sparsebn/issues.

Attaching package: â

The following object is masked from â:

select

A list of interventions was not specified: Assuming data is purely observational.
Error in weights < -1 || weights > 1 :
'length = 324' in coercion to 'logical(1)'
Calls: estimate.dag ... -> ccdr_call -> ccdr_gridR -> ccdr_singleR
Execution halted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant