{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Example to demonstrate optimized backdoor variable search for Causal Identification\n", "\n", "This notebook compares the performance between causal identification using vanilla backdoor search and the optimized backdoor search and demonstrates the performance gains obtained by using the latter." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import time\n", "import random\n", "from networkx.linalg.graphmatrix import adjacency_matrix\n", "import numpy as np\n", "import pandas as pd\n", "import networkx as nx\n", "\n", "import dowhy\n", "from dowhy import CausalModel\n", "from dowhy.utils import graph_operations\n", "import dowhy.datasets\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Create Random Graph \n", "In this section, we create a random graph with the designated number of nodes (10 in this case)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "n = 10\n", "p = 0.5\n", "\n", "G = nx.generators.random_graphs.fast_gnp_random_graph(n, p, directed=True)\n", "graph = nx.DiGraph([(u,v) for (u,v) in G.edges() if u