Skip to content

Commit

Permalink
Change do_sampled_demo
Browse files Browse the repository at this point in the history
Signed-off-by: rahulbshrestha <[email protected]>
  • Loading branch information
rahulbshrestha committed Jun 28, 2024
1 parent 333c9a8 commit 7ebe273
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions docs/source/example_notebooks/do_sampler_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,21 @@
"metadata": {},
"outputs": [],
"source": [
"from dowhy import CausalModel\n",
"from dowhy.causal_graph import CausalGraph\n",
"\n",
"\n",
"causes = ['D']\n",
"outcomes = ['Y']\n",
"common_causes = ['Z']\n",
"\n",
"model = CausalModel(df, \n",
" causes,\n",
" outcomes,\n",
" common_causes=common_causes)\n",
"nx_graph = model._graph._graph"
"graph = CausalGraph(\n",
" causes,\n",
" outcomes,\n",
" common_cause_names=common_causes,\n",
" observed_node_names=df.columns.tolist(),\n",
")\n",
"\n",
"nx_graph = graph._graph"
]
},
{
Expand All @@ -145,7 +149,9 @@
"metadata": {},
"outputs": [],
"source": [
"identification = model.identify_effect(proceed_when_unidentifiable=True)"
"from dowhy.causal_identifier import identify_effect\n",
"\n",
"identification = identify_effect(nx_graph, action_nodes=causes, outcome_nodes=outcomes, observed_nodes=list(graph.get_all_nodes(include_unobserved=False)))"
]
},
{
Expand Down Expand Up @@ -225,7 +231,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.11.8"
},
"toc": {
"base_numbering": 1,
Expand Down

0 comments on commit 7ebe273

Please sign in to comment.