-
Notifications
You must be signed in to change notification settings - Fork 10
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
Graph structure repair based on data #162
Comments
It's not clear to me why you would make a test between Here are the all of the conditional independencies for this graph calculated with
Click here to get the codefrom y0.graph import NxMixedGraph
from y0.dsl import Z1, Z2, Z3, Variable, X, Y
from y0.algorithm.conditional_independencies import get_conditional_independencies
import pandas as pd
from tabulate import tabulate
R1, R2, R3 = (Variable(f"R{i + 1}") for i in range(3))
M1, M2 = (Variable(f"M{i + 1}") for i in range(2))
def main():
graph = NxMixedGraph.from_edges(
directed=[
(Z1, X),
(Z1, Z2),
(Z2, Z3),
(Z3, Y),
(X, M1),
(M1, M2),
(M2, R1),
(M2, Y),
(R1, R2),
(R2, R3),
(R3, Y),
],
undirected=[(X, Z1)],
)
cis = get_conditional_independencies(graph)
df = pd.DataFrame(
sorted(
(
conditional_independency.left,
conditional_independency.right,
", ".join(sorted(v.name for v in conditional_independency.conditions)),
)
for conditional_independency in cis
if conditional_independency.separated
),
columns=["left", "right", "conditions"],
)
print(tabulate(df, headers=df.columns, tablefmt="github", showindex=False))
if __name__ == "__main__":
main() |
So it can be given no variables or any combination of variables |
Turns out @srtaheri is looking for https://github.com/y0-causal-inference/y0/blob/main/src/y0/algorithm/falsification.py |
This takes a prior knowledge on the network in the form of DAG or ADMG, as well as the available data (can be observational and/or interventional data), and repairs the network structure based on given data. The goal is to make sure that the conditional independence implied by the data are aligned with the conditional independence implied by the network. Here are the steps:
Now we have a repaired network with additional bi-directed edges. If the prior knowledge graph was an ADMG, we now have a new ADMG with additional bi-directed edges. If the prior knowledge graph was a DAG, it is now converted to an ADMG.
The text was updated successfully, but these errors were encountered: