-
Notifications
You must be signed in to change notification settings - Fork 231
Description
Description
When running the GES algorithm, a type error is raised, despite the input being correctly formatted as a numpy.ndarray. The issue appears to stem from an internal type mismatch during the processing of the graph object within the GES, BOSS, and GRASP implementation.
The issue persists with both real-world and minimal synthetic datasets, indicating a potential problem in the library's handling of the GeneralGraph type.
Analysis
- The error originates from the dag2cpdag function in the DAG2CPDAG.py file.
- The GES implementation in GES.py passes a GeneralGraph object to dag2cpdag, but this function only accepts inputs of type Dag or np.ndarray.
Steps to Reproduce
The issue can be reproduced with the following minimal example:
from causallearn.search.ScoreBased.GES import ges
import numpy as np
data = np.array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
record = ges(data) # Expected to work, but failsExpected Behavior
The GES function should successfully execute and return a Record object containing the causal structure inferred from the input data.
Proposed Solutions
- Modify dag2cpdag: Update the function to handle GeneralGraph objects, converting them to Dag if necessary.
- Adjust GES Implementation: Convert the GeneralGraph object to Dag before calling dag2cpdag.
Environment
- Python Version: 3.8.10
- CausalLearn : 0.1.3.9
Thank you for looking into this, and please let me know if further details are required!