diff --git a/causallearn/search/ConstraintBased/FCI.py b/causallearn/search/ConstraintBased/FCI.py index 2738d769..ff3f92d0 100644 --- a/causallearn/search/ConstraintBased/FCI.py +++ b/causallearn/search/ConstraintBased/FCI.py @@ -2,7 +2,7 @@ import warnings from queue import Queue -from typing import List, Set, Tuple, Dict +from typing import List, Set, Tuple, Dict, Generator from numpy import ndarray from causallearn.graph.Edge import Edge @@ -17,6 +17,19 @@ from causallearn.utils.PCUtils.BackgroundKnowledge import BackgroundKnowledge from itertools import combinations +def is_uncovered_path(nodes: List[Node], G: Graph) -> bool: + """ + Determines whether the given path is an uncovered path in this graph. + + A path is an uncovered path if no two nonconsecutive nodes (Vi-1 and Vi+1) in the path are + adjacent. + """ + for i in range(len(nodes) - 2): + if G.is_adjacent_to(nodes[i], nodes[i + 2]): + return False + return True + + def traverseSemiDirected(node: Node, edge: Edge) -> Node | None: if node == edge.get_node1(): if edge.get_endpoint1() == Endpoint.TAIL or edge.get_endpoint1() == Endpoint.CIRCLE: @@ -26,8 +39,17 @@ def traverseSemiDirected(node: Node, edge: Edge) -> Node | None: return edge.get_node1() return None +def traverseCircle(node: Node, edge: Edge) -> Node | None: + if node == edge.get_node1(): + if edge.get_endpoint1() == Endpoint.CIRCLE and edge.get_endpoint2() == Endpoint.CIRCLE: + return edge.get_node2() + elif node == edge.get_node2(): + if edge.get_endpoint1() == Endpoint.CIRCLE and edge.get_endpoint2() == Endpoint.CIRCLE: + return edge.get_node1() + return None + -def existsSemiDirectedPath(node_from: Node, node_to: Node, G: Graph) -> bool: +def existsSemiDirectedPath(node_from: Node, node_to: Node, G: Graph) -> bool: ## TODO: Now it does not detect whether the path is an uncovered path Q = Queue() V = set() @@ -60,6 +82,42 @@ def existsSemiDirectedPath(node_from: Node, node_to: Node, G: Graph) -> bool: return False +def GetUncoveredCirclePath(node_from: Node, node_to: Node, G: Graph, exclude_node: List[Node]) -> Generator[Node] | None: + Q = Queue() + V = set() + + path = [node_from] + + for node_u in G.get_adjacent_nodes(node_from): + if node_u in exclude_node: + continue + edge = G.get_edge(node_from, node_u) + node_c = traverseCircle(node_from, edge) + + if node_c is None or node_c in exclude_node: + continue + + if not V.__contains__(node_c): + V.add(node_c) + Q.put((node_c, path + [node_c])) + + while not Q.empty(): + node_t, path = Q.get_nowait() + if node_t == node_to and is_uncovered_path(path, G): + yield path + + for node_u in G.get_adjacent_nodes(node_t): + edge = G.get_edge(node_t, node_u) + node_c = traverseCircle(node_t, edge) + + if node_c is None or node_c in exclude_node: + continue + + if not V.__contains__(node_c): + V.add(node_c) + Q.put((node_c, path + [node_c])) + + def existOnePathWithPossibleParents(previous, node_w: Node, node_x: Node, node_b: Node, graph: Graph) -> bool: if node_w == node_x: @@ -371,6 +429,131 @@ def ruleR3(graph: Graph, sep_sets: Dict[Tuple[int, int], Set[int]], bk: Backgrou changeFlag = True return changeFlag +def ruleR5(graph: Graph, changeFlag: bool, + verbose: bool = False) -> bool: + """ + Rule R5 of the FCI algorithm. + by Jiji Zhang, 2008, "On the completeness of orientation rules for causal discovery in the presence of latent confounders and selection bias"] + + This function orients any edge that is part of an uncovered circle path between two nodes A and B, + if such a path exists. The path must start and end with a circle edge and must be uncovered, i.e. the + nodes on the path must not be adjacent to A or B. The orientation of the edges on the path is set to + double tail. + """ + nodes = graph.get_nodes() + def orient_on_path_helper(path, node_A, node_B): + # orient A - C, D - B + edge = graph.get_edge(node_A, path[0]) + graph.remove_edge(edge) + graph.add_edge(Edge(node_A, path[0], Endpoint.TAIL, Endpoint.TAIL)) + + edge = graph.get_edge(node_B, path[-1]) + graph.remove_edge(edge) + graph.add_edge(Edge(node_B, path[-1], Endpoint.TAIL, Endpoint.TAIL)) + if verbose: + print("Orienting edge A - C (Double tail): " + graph.get_edge(node_A, path[0]).__str__()) + print("Orienting edge B - D (Double tail): " + graph.get_edge(node_B, path[-1]).__str__()) + + # orient everything on the path to both tails + for i in range(len(path) - 1): + edge = graph.get_edge(path[i], path[i + 1]) + graph.remove_edge(edge) + graph.add_edge(Edge(path[i], path[i + 1], Endpoint.TAIL, Endpoint.TAIL)) + if verbose: + print("Orienting edge (Double tail): " + graph.get_edge(path[i], path[i + 1]).__str__()) + + for node_B in nodes: + intoBCircles = graph.get_nodes_into(node_B, Endpoint.CIRCLE) + + for node_A in intoBCircles: + found_paths_between_AB = [] + if graph.get_endpoint(node_B, node_A) != Endpoint.CIRCLE: + continue + else: + # Check if there is an uncovered circle path between A and B (A o-o C .. D o-o B) + # s.t. A is not adjacent to D and B is not adjacent to C + a_node_idx = graph.node_map[node_A] + b_node_idx = graph.node_map[node_B] + a_adj_nodes = graph.get_adjacent_nodes(node_A) + b_adj_nodes = graph.get_adjacent_nodes(node_B) + + # get the adjacent nodes with circle edges of A and B + a_circle_adj_nodes_set = [node for node in a_adj_nodes if graph.node_map[node] != a_node_idx and graph.node_map[node]!= b_node_idx + and graph.get_endpoint(node, node_A) == Endpoint.CIRCLE and graph.get_endpoint(node_A, node) == Endpoint.CIRCLE] + b_circle_adj_nodes_set = [node for node in b_adj_nodes if graph.node_map[node] != a_node_idx and graph.node_map[node]!= b_node_idx + and graph.get_endpoint(node, node_B) == Endpoint.CIRCLE and graph.get_endpoint(node_B, node) == Endpoint.CIRCLE] + + # get the adjacent nodes with circle edges of A and B that is non adjacent to B and A, respectively + for node_C in a_circle_adj_nodes_set: + if graph.is_adjacent_to(node_B, node_C): + continue + for node_D in b_circle_adj_nodes_set: + if graph.is_adjacent_to(node_A, node_D): + continue + paths = GetUncoveredCirclePath(node_from=node_C, node_to=node_D, G=graph, exclude_node=[node_A, node_B]) # get the uncovered circle path between C and D, excluding A and B + found_paths_between_AB.append(paths) + + # Orient the uncovered circle path between A and B + for paths in found_paths_between_AB: + for path in paths: + changeFlag = True + if verbose: + print("Find uncovered circle path between A and B: " + graph.get_edge(node_A, node_B).__str__()) + edge = graph.get_edge(node_A, node_B) + graph.remove_edge(edge) + graph.add_edge(Edge(node_A, node_B, Endpoint.TAIL, Endpoint.TAIL)) + orient_on_path_helper(path, node_A, node_B) + + return changeFlag + +def ruleR6(graph: Graph, changeFlag: bool, + verbose: bool = False) -> bool: + nodes = graph.get_nodes() + + for node_B in nodes: + # Find A - B + intoBTails = graph.get_nodes_into(node_B, Endpoint.TAIL) + exist = False + for node_A in intoBTails: + if graph.get_endpoint(node_B, node_A) == Endpoint.TAIL: + exist = True + if not exist: + continue + # Find B o-*C + intoBCircles = graph.get_nodes_into(node_B, Endpoint.CIRCLE) + for node_C in intoBCircles: + changeFlag = True + edge = graph.get_edge(node_B, node_C) + graph.remove_edge(edge) + graph.add_edge(Edge(node_B, node_C, Endpoint.TAIL, edge.get_proximal_endpoint(node_C))) + if verbose: + print("Orienting edge by rule 6): " + graph.get_edge(node_B, node_C).__str__()) + + return changeFlag + + +def ruleR7(graph: Graph, changeFlag: bool, + verbose: bool = False) -> bool: + nodes = graph.get_nodes() + + for node_B in nodes: + # Find A -o B + intoBCircles = graph.get_nodes_into(node_B, Endpoint.CIRCLE) + node_A_list = [node for node in intoBCircles if graph.get_endpoint(node_B, node) == Endpoint.TAIL] + + # Find B o-*C + for node_C in intoBCircles: + # pdb.set_trace() + for node_A in node_A_list: + # pdb.set_trace() + if not graph.is_adjacent_to(node_A, node_C): + changeFlag = True + edge = graph.get_edge(node_B, node_C) + graph.remove_edge(edge) + graph.add_edge(Edge(node_B, node_C, Endpoint.TAIL, edge.get_proximal_endpoint(node_C))) + if verbose: + print("Orienting edge by rule 7): " + graph.get_edge(node_B, node_C).__str__()) + return changeFlag def getPath(node_c: Node, previous) -> List[Node]: l = [] @@ -544,9 +727,8 @@ def ruleR4B(graph: Graph, maxPathLength: int, data: ndarray, independence_test_m -def rule8(graph: Graph, nodes: List[Node]): - nodes = graph.get_nodes() - changeFlag = False +def rule8(graph: Graph, nodes: List[Node], changeFlag): + nodes = graph.get_nodes() if nodes is None else nodes for node_B in nodes: adj = graph.get_adjacent_nodes(node_B) if len(adj) < 2: @@ -601,9 +783,9 @@ def find_possible_children(graph: Graph, parent_node, en_nodes=None): return potential_child_nodes -def rule9(graph: Graph, nodes: List[Node]): - changeFlag = False - nodes = graph.get_nodes() +def rule9(graph: Graph, nodes: List[Node], changeFlag): + # changeFlag = False + nodes = graph.get_nodes() if nodes is None else nodes for node_C in nodes: intoCArrows = graph.get_nodes_into(node_C, Endpoint.ARROW) for node_A in intoCArrows: @@ -629,8 +811,8 @@ def rule9(graph: Graph, nodes: List[Node]): return changeFlag -def rule10(graph: Graph): - changeFlag = False +def rule10(graph: Graph, changeFlag): + # changeFlag = False nodes = graph.get_nodes() for node_C in nodes: intoCArrows = graph.get_nodes_into(node_C, Endpoint.ARROW) @@ -895,6 +1077,7 @@ def fci(dataset: ndarray, independence_test_method: str=fisherz, alpha: float = graph, sep_sets, test_results = fas(dataset, nodes, independence_test_method=independence_test_method, alpha=alpha, knowledge=background_knowledge, depth=depth, verbose=verbose, show_progress=show_progress) + # pdb.set_trace() reorientAllWith(graph, Endpoint.CIRCLE) rule0(graph, nodes, sep_sets, background_knowledge, verbose) @@ -925,12 +1108,22 @@ def fci(dataset: ndarray, independence_test_method: str=fisherz, alpha: float = if verbose: print("Epoch") + # rule 5 + change_flag = ruleR5(graph, change_flag, verbose) + + # rule 6 + change_flag = ruleR6(graph, change_flag, verbose) + + # rule 7 + change_flag = ruleR7(graph, change_flag, verbose) + # rule 8 - change_flag = rule8(graph,nodes) + change_flag = rule8(graph,nodes, change_flag) + # rule 9 - change_flag = rule9(graph, nodes) + change_flag = rule9(graph, nodes, change_flag) # rule 10 - change_flag = rule10(graph) + change_flag = rule10(graph, change_flag) graph.set_pag(True) diff --git a/causallearn/utils/DAG2PAG.py b/causallearn/utils/DAG2PAG.py index 9980b96b..2a091f72 100644 --- a/causallearn/utils/DAG2PAG.py +++ b/causallearn/utils/DAG2PAG.py @@ -10,10 +10,11 @@ from causallearn.graph.Endpoint import Endpoint from causallearn.graph.GeneralGraph import GeneralGraph from causallearn.graph.Node import Node -from causallearn.search.ConstraintBased.FCI import rule0, rulesR1R2cycle, ruleR3, ruleR4B +from causallearn.search.ConstraintBased.FCI import rule0, rulesR1R2cycle, ruleR3, ruleR4B, ruleR5, ruleR6, ruleR7, rule8, rule9, rule10 from causallearn.utils.cit import CIT, d_separation -def dag2pag(dag: Dag, islatent: List[Node]) -> GeneralGraph: + +def dag2pag(dag: Dag, islatent: List[Node], isselection: List[Node] = []) -> GeneralGraph: """ Convert a DAG to its corresponding PAG Parameters @@ -27,8 +28,8 @@ def dag2pag(dag: Dag, islatent: List[Node]) -> GeneralGraph: dg = nx.DiGraph() true_dag = nx.DiGraph() nodes = dag.get_nodes() - observed_nodes = list(set(nodes) - set(islatent)) - mod_nodes = observed_nodes + islatent + observed_nodes = list(set(nodes) - set(islatent) - set(isselection)) + mod_nodes = observed_nodes + islatent + isselection nodes = dag.get_nodes() nodes_ids = {node: i for i, node in enumerate(nodes)} mod_nodeids = {node: i for i, node in enumerate(mod_nodes)} @@ -65,7 +66,7 @@ def dag2pag(dag: Dag, islatent: List[Node]) -> GeneralGraph: for Z in combinations(observed_nodes, l): if nodex in Z or nodey in Z: continue - if d_separated(dg, {nodes_ids[nodex]}, {nodes_ids[nodey]}, set(nodes_ids[z] for z in Z)): + if d_separated(dg, {nodes_ids[nodex]}, {nodes_ids[nodey]}, set(nodes_ids[z] for z in Z) | set([nodes_ids[s] for s in isselection])): if edge: PAG.remove_edge(edge) sepset[(nodes_ids[nodex], nodes_ids[nodey])] |= set(Z) @@ -105,6 +106,13 @@ def dag2pag(dag: Dag, islatent: List[Node]) -> GeneralGraph: change_flag = ruleR4B(PAG, -1, data, independence_test_method, 0.05, sep_sets=sepset_reindexed, change_flag=change_flag, bk=None, verbose=False) + change_flag = ruleR5(PAG, changeFlag=change_flag, verbose=True) + change_flag = ruleR6(PAG, changeFlag=change_flag) + change_flag = ruleR7(PAG, changeFlag=change_flag) + change_flag = rule8(PAG, nodes=observed_nodes, changeFlag=change_flag) + change_flag = rule9(PAG, nodes=observed_nodes, changeFlag=change_flag) + change_flag = rule10(PAG, changeFlag=change_flag) + return PAG diff --git a/tests/TestDAG2PAG.py b/tests/TestDAG2PAG.py index 569fc945..004ea897 100644 --- a/tests/TestDAG2PAG.py +++ b/tests/TestDAG2PAG.py @@ -72,3 +72,17 @@ def test_case3(self): print(pag) graphviz_pag = GraphUtils.to_pgv(pag) graphviz_pag.draw("pag.png", prog='dot', format='png') + + def test_case_selection(self): + nodes = [] + for i in range(5): + nodes.append(GraphNode(str(i))) + dag = Dag(nodes) + dag.add_directed_edge(nodes[0], nodes[1]) + dag.add_directed_edge(nodes[1], nodes[2]) + dag.add_directed_edge(nodes[2], nodes[3]) + # Selection nodes + dag.add_directed_edge(nodes[3], nodes[4]) + dag.add_directed_edge(nodes[0], nodes[4]) + pag = dag2pag(dag, islatent=[], isselection=[nodes[4]]) + print(pag) diff --git a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_alarm_fci_chisq_0.05.txt b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_alarm_fci_chisq_0.05.txt index 2430e1de..ce08eb4f 100644 --- a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_alarm_fci_chisq_0.05.txt +++ b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_alarm_fci_chisq_0.05.txt @@ -3,7 +3,7 @@ 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 -1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2 0 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +2 0 0 0 -1 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 2 0 2 0 0 0 0 2 -1 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 -1 0 -1 0 0 0 0 2 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 diff --git a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_andes_fci_chisq_0.05.txt b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_andes_fci_chisq_0.05.txt index a9f9886f..934b13bd 100644 --- a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_andes_fci_chisq_0.05.txt +++ b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_andes_fci_chisq_0.05.txt @@ -39,8 +39,8 @@ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_asia_fci_chisq_0.05.txt b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_asia_fci_chisq_0.05.txt index c0467173..b3aa50bb 100644 --- a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_asia_fci_chisq_0.05.txt +++ b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_asia_fci_chisq_0.05.txt @@ -1,7 +1,7 @@ 0 0 0 0 0 0 2 0 0 0 0 0 0 2 0 0 0 0 0 2 2 0 0 0 -0 0 2 0 0 2 0 0 +0 0 2 0 0 -1 0 0 0 0 2 0 0 0 0 2 0 1 0 1 0 0 0 0 2 0 0 0 0 0 0 0 diff --git a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_barley_fci_chisq_0.05.txt b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_barley_fci_chisq_0.05.txt index b1986bd1..864b9e5f 100644 --- a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_barley_fci_chisq_0.05.txt +++ b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_barley_fci_chisq_0.05.txt @@ -1,4 +1,4 @@ -0 0 0 2 0 0 2 0 0 2 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 -1 0 0 -1 0 0 -1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 diff --git a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_child_fci_chisq_0.05.txt b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_child_fci_chisq_0.05.txt index bac534d8..a739c18f 100644 --- a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_child_fci_chisq_0.05.txt +++ b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_child_fci_chisq_0.05.txt @@ -12,9 +12,9 @@ 1 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 -1 -1 1 -1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 -0 0 0 0 0 0 2 0 0 0 0 2 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 2 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 0 2 2 2 2 0 0 0 0 0 2 0 0 0 0 0 0 0 0 +0 0 -1 2 -1 -1 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 2 0 -1 0 0 0 0 0 0 diff --git a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_hailfinder_fci_chisq_0.05.txt b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_hailfinder_fci_chisq_0.05.txt index 894ff9cd..4671059c 100644 --- a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_hailfinder_fci_chisq_0.05.txt +++ b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_hailfinder_fci_chisq_0.05.txt @@ -21,7 +21,7 @@ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_hepar2_fci_chisq_0.05.txt b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_hepar2_fci_chisq_0.05.txt index 9e6c7aac..0569bd1b 100644 --- a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_insurance_fci_chisq_0.05.txt b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_insurance_fci_chisq_0.05.txt index 80a266db..4d6a5b4a 100644 --- a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_insurance_fci_chisq_0.05.txt +++ b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_insurance_fci_chisq_0.05.txt @@ -2,7 +2,7 @@ -1 0 1 1 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 -1 0 0 0 0 0 0 0 0 -1 1 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 -1 0 0 0 1 0 0 0 -1 -1 0 0 0 0 0 0 0 -1 -0 0 2 0 0 0 2 0 0 0 0 2 0 0 0 0 2 0 0 0 0 0 0 0 2 0 0 +0 0 2 0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 -1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 -1 0 diff --git a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_water_fci_chisq_0.05.txt b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_water_fci_chisq_0.05.txt index cee53cda..bd9c2aec 100644 --- a/tests/TestData/benchmark_returned_results/bnlearn_discr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 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_win95pts_fci_chisq_0.05.txt b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_win95pts_fci_chisq_0.05.txt index b971fb87..8bc6b692 100644 --- a/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_win95pts_fci_chisq_0.05.txt +++ b/tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_win95pts_fci_chisq_0.05.txt @@ -8,7 +8,7 @@ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 2 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0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/tests/TestData/benchmark_returned_results/linear_10_fci_fisherz_0.05.txt b/tests/TestData/benchmark_returned_results/linear_10_fci_fisherz_0.05.txt index 046443a3..07a248fb 100644 --- a/tests/TestData/benchmark_returned_results/linear_10_fci_fisherz_0.05.txt +++ b/tests/TestData/benchmark_returned_results/linear_10_fci_fisherz_0.05.txt @@ -5,7 +5,7 @@ 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 2 0 0 0 0 2 0 0 0 2 2 0 +0 0 0 0 0 0 0 0 -1 0 0 0 0 -1 0 0 0 2 -1 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -1 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 0 0 0 0 0 diff --git a/tests/TestFCI.py b/tests/TestFCI.py index 7884cbde..e2fb683c 100644 --- a/tests/TestFCI.py +++ b/tests/TestFCI.py @@ -10,8 +10,11 @@ import pandas as pd from causallearn.graph.Dag import Dag +from causallearn.graph.Edge import Edge +from causallearn.graph.Endpoint import Endpoint +from causallearn.graph.GeneralGraph import GeneralGraph from causallearn.graph.GraphNode import GraphNode -from causallearn.search.ConstraintBased.FCI import fci +from causallearn.search.ConstraintBased.FCI import fci, ruleR5 from causallearn.utils.cit import chisq, fisherz, kci, d_separation from causallearn.utils.DAG2PAG import dag2pag from causallearn.utils.GraphUtils import GraphUtils @@ -30,21 +33,21 @@ ######################################### Test Notes ########################################### BENCHMARK_TXTFILE_TO_MD5 = { - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_asia_fci_chisq_0.05.txt": "65f54932a9d8224459e56c40129e6d8b", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_cancer_fci_chisq_0.05.txt": "0312381641cb3b4818e0c8539f74e802", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_earthquake_fci_chisq_0.05.txt": "a1160b92ce15a700858552f08e43b7de", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_sachs_fci_chisq_0.05.txt": "dced4a202fc32eceb75f53159fc81f3b", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_survey_fci_chisq_0.05.txt": "b1a28eee1e0c6ea8a64ac1624585c3f4", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_alarm_fci_chisq_0.05.txt": "c3bbc2b8aba456a4258dd071a42085bc", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_barley_fci_chisq_0.05.txt": "4a5000e7a582083859ee6aef15073676", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_child_fci_chisq_0.05.txt": "6b7858589e12f04b0f489ba4589a1254", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_insurance_fci_chisq_0.05.txt": "9975942b936aa2b1fc90c09318ca2d08", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_water_fci_chisq_0.05.txt": "48eee804d59526187b7ecd0519556ee5", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_hailfinder_fci_chisq_0.05.txt": "6b9a6b95b6474f8530e85c022f4e749c", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_hepar2_fci_chisq_0.05.txt": "4aae21ff3d9aa2435515ed2ee402294c", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_win95pts_fci_chisq_0.05.txt": "648fdf271e1440c06ca2b31b55ef1f3f", - "tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_andes_fci_chisq_0.05.txt": "04092ae93e54c727579f08bf5dc34c77", - "tests/TestData/benchmark_returned_results/linear_10_fci_fisherz_0.05.txt": "289c86f9c665bf82bbcc4c9e1dcec3e7" + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_asia_fci_chisq_0.05.txt': '4b014aa90aee456bc02dddd008d8be1f', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_cancer_fci_chisq_0.05.txt': '0312381641cb3b4818e0c8539f74e802', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_earthquake_fci_chisq_0.05.txt': 'a1160b92ce15a700858552f08e43b7de', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_sachs_fci_chisq_0.05.txt': 'dced4a202fc32eceb75f53159fc81f3b', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_survey_fci_chisq_0.05.txt': 'b1a28eee1e0c6ea8a64ac1624585c3f4', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_alarm_fci_chisq_0.05.txt': '4b06f6ea7fefe66255a3d16cb8a3711f', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_barley_fci_chisq_0.05.txt': 'a926e329b2bf2b397d3676e9d2020483', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_child_fci_chisq_0.05.txt': '5eff3ea6ce2e2daa53d6b649bd9c31fe', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_insurance_fci_chisq_0.05.txt': '55eed065b8dfc6a21610d3d6e18423c6', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_water_fci_chisq_0.05.txt': '48917f914c8f80684ae2abde87417d5c', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_hailfinder_fci_chisq_0.05.txt': 'bcffe793866db6ddfe9cc602081789cd', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_hepar2_fci_chisq_0.05.txt': '3558683a485588a41493b1a2f2c1d370', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_win95pts_fci_chisq_0.05.txt': '52596ace09c45656f61c70d0e66bdd6a', + 'tests/TestData/benchmark_returned_results/bnlearn_discrete_10000_andes_fci_chisq_0.05.txt': '4b7e2ecba5eb50c7266f24670d0d0ae9', + 'tests/TestData/benchmark_returned_results/linear_10_fci_fisherz_0.05.txt': 'eaabd1fbb16bc152b45e456c30166c55' } # INCONSISTENT_RESULT_GRAPH_ERRMSG = "Returned graph is inconsistent with the benchmark. Please check your code with the commit 5918419." @@ -211,3 +214,23 @@ def test_er_graph(self): print(G) print(f'fci(data, d_separation, 0.05):') self.run_simulate_data_test(pag, G) + + def test_rule5(self): + nodes = [] + for i in range(7): + nodes.append(GraphNode(str(i))) + g = GeneralGraph(nodes) + g.add_edge(Edge(nodes[0], nodes[1], Endpoint.CIRCLE, Endpoint.CIRCLE)) + g.add_edge(Edge(nodes[0], nodes[2], Endpoint.CIRCLE, Endpoint.CIRCLE)) + g.add_edge(Edge(nodes[0], nodes[5], Endpoint.CIRCLE, Endpoint.CIRCLE)) + g.add_edge(Edge(nodes[0], nodes[6], Endpoint.CIRCLE, Endpoint.CIRCLE)) + g.add_edge(Edge(nodes[1], nodes[3], Endpoint.CIRCLE, Endpoint.CIRCLE)) + g.add_edge(Edge(nodes[2], nodes[4], Endpoint.CIRCLE, Endpoint.CIRCLE)) + g.add_edge(Edge(nodes[3], nodes[5], Endpoint.CIRCLE, Endpoint.CIRCLE)) + g.add_edge(Edge(nodes[4], nodes[6], Endpoint.CIRCLE, Endpoint.CIRCLE)) + + ruleR5(g, changeFlag=True, verbose=True) + + for edge in g.get_graph_edges(): + assert edge.get_endpoint1() == Endpoint.TAIL + assert edge.get_endpoint2() == Endpoint.TAIL