Skip to content

Commit 5d788b9

Browse files
committed
fixed
1 parent 816baae commit 5d788b9

File tree

1 file changed

+5
-2
lines changed
  • causallearn/search/ConstraintBased

1 file changed

+5
-2
lines changed

causallearn/search/ConstraintBased/FCI.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,8 @@ def _contains_all(set_a: Set[Node], set_b: Set[Node]):
829829

830830

831831
def fci(dataset: ndarray, independence_test_method: str=fisherz, alpha: float = 0.05, depth: int = -1,
832-
max_path_length: int = -1, verbose: bool = False, background_knowledge: BackgroundKnowledge | None = None, show_progress: bool = True,
832+
max_path_length: int = -1, verbose: bool = False, background_knowledge: BackgroundKnowledge | None = None,
833+
show_progress: bool = True, node_names = None,
833834
**kwargs) -> Tuple[Graph, List[Edge]]:
834835
"""
835836
Perform Fast Causal Inference (FCI) algorithm for causal discovery
@@ -884,8 +885,10 @@ def fci(dataset: ndarray, independence_test_method: str=fisherz, alpha: float =
884885

885886

886887
nodes = []
888+
if node_names is None:
889+
node_names = [f"X{i + 1}" for i in range(dataset.shape[1])]
887890
for i in range(dataset.shape[1]):
888-
node = GraphNode(f"X{i + 1}")
891+
node = GraphNode(node_names[i])
889892
node.add_attribute("id", i)
890893
nodes.append(node)
891894

0 commit comments

Comments
 (0)