Skip to content

Commit

Permalink
remove further causalgraphicalmodel code
Browse files Browse the repository at this point in the history
  • Loading branch information
fehiepsi committed Feb 15, 2024
1 parent 0df6a97 commit ef3bff9
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions notebooks/05_the_many_variables_and_the_spurious_waffles.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1690,28 +1690,19 @@
"metadata": {},
"outputs": [],
"source": [
"dag5_7 = CausalGraphicalModel(\n",
" nodes=[\"M\", \"K\", \"N\"], edges=[(\"M\", \"K\"), (\"N\", \"K\"), (\"M\", \"N\")]\n",
")\n",
"dag5_7 = nx.DiGraph()\n",
"dag5_7.add_edges_from([(\"M\", \"K\"), (\"N\", \"K\"), (\"M\", \"N\")])\n",
"coordinates = {\"M\": (0, 0.5), \"K\": (1, 1), \"N\": (2, 0.5)}\n",
"nodes = list(dag5_7.dag.nodes.keys())\n",
"edges = list(dag5_7.dag.edges.keys())\n",
"MElist = []\n",
"for i in range(2):\n",
" for j in range(2):\n",
" for k in range(2):\n",
" try:\n",
" new_dag = CausalGraphicalModel(\n",
" nodes=nodes,\n",
" edges=[\n",
" edges[0] if i == 0 else edges[0][::-1],\n",
" edges[1] if j == 0 else edges[1][::-1],\n",
" edges[2] if k == 0 else edges[2][::-1],\n",
" ],\n",
" )\n",
" MElist.append(new_dag)\n",
" except:\n",
" pass"
" new_dag = nx.DiGraph()\n",
" new_dag.add_edges_from(\n",
" [edge[::-1] if flip else edge for edge, flip in zip(dag5_7.edges, (i, j, k))]\n",
" )\n",
" if not list(nx.simple_cycles(new_dag)):\n",
" MElist.append(new_dag)"
]
},
{
Expand Down

0 comments on commit ef3bff9

Please sign in to comment.