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

Minor issues fix #184

Merged
merged 4 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading