diff --git a/src/y0/algorithm/repair.py b/src/y0/algorithm/repair.py new file mode 100644 index 000000000..0dcf77412 --- /dev/null +++ b/src/y0/algorithm/repair.py @@ -0,0 +1,17 @@ +"""Data-driven graph repair.""" + +from y0.graph import NxMixedGraph +import pandas as pd +from y0.algorithm.conditional_independencies import get_conditional_independencies +from y0.algorithm.falsification import get_graph_falsifications + +__all__ = [ + "repair_graph", +] + + +def repair_graph(graph: NxMixedGraph, data: pd.DataFrame) -> NxMixedGraph: + """Repair the graph based on calculatable conditional dependencies in the data.""" + falsifications = get_graph_falsifications(graph=graph, df=data) + d_separations = get_conditional_independencies(graph) + raise NotImplementedError diff --git a/tests/test_algorithm/test_repair.py b/tests/test_algorithm/test_repair.py new file mode 100644 index 000000000..df5c5ceb8 --- /dev/null +++ b/tests/test_algorithm/test_repair.py @@ -0,0 +1,17 @@ +"""Data-driven graph repair.""" + +import unittest +from y0.algorithm.repair import repair_graph +from y0.graph import NxMixedGraph +import pandas as pd + +class TestRepair(unittest.TestCase): + """Test case for data-driven graph repair.""" + + def test_repair(self): + graph: NxMixedGraph = ... + data:pd.DataFrame = ... + new_graph = repair_graph(graph=graph, data=data) + + # TODO implement test + raise NotImplementedError \ No newline at end of file