Skip to content

Commit

Permalink
Merge pull request #184 from EvieQ01/main
Browse files Browse the repository at this point in the history
Minor issues fix
  • Loading branch information
kunwuz authored Jul 3, 2024
2 parents 728c43d + 5d788b9 commit ae2f5b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions causallearn/search/ConstraintBased/FCI.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,8 @@ def _contains_all(set_a: Set[Node], set_b: Set[Node]):


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


nodes = []
if node_names is None:
node_names = [f"X{i + 1}" for i in range(dataset.shape[1])]
for i in range(dataset.shape[1]):
node = GraphNode(f"X{i + 1}")
node = GraphNode(node_names[i])
node.add_attribute("id", i)
nodes.append(node)

Expand Down
2 changes: 1 addition & 1 deletion causallearn/utils/PCUtils/BackgroundKnowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def is_forbidden(self, node1: Node, node2: Node) -> bool:

# then check in tier_map
if self.tier_value_map.keys().__contains__(node1) and self.tier_value_map.keys().__contains__(node2):
if self.tier_value_map.get(node1) >= self.tier_value_map.get(node2):
if self.tier_value_map.get(node1) > self.tier_value_map.get(node2): # Allow orientation within the same tier
return True

return False
Expand Down

0 comments on commit ae2f5b2

Please sign in to comment.