updated python version for package workflow and removed a notebook from test (#339)

* updated python version for workflows

* removed optimize backdoor from tests since it will be phased out
This commit is contained in:
Amit Sharma 2021-11-28 13:44:04 +05:30 коммит произвёл GitHub
Родитель 2d739aad7d
Коммит 0f554f3941
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 65 добавлений и 55 удалений

2
.github/workflows/python-package.yml поставляемый
Просмотреть файл

@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2

Просмотреть файл

@ -2,16 +2,18 @@
"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."
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import time\n",
"import random\n",
@ -24,21 +26,30 @@
"from dowhy import CausalModel\n",
"from dowhy.utils import graph_operations\n",
"import dowhy.datasets\n"
],
"outputs": [],
"metadata": {}
]
},
{
"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)."
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Graph Generated.\n",
"Dataframe Generated.\n"
]
}
],
"source": [
"n = 10\n",
"p = 0.5\n",
@ -54,31 +65,32 @@
"\n",
"df = pd.DataFrame(columns=nodes)\n",
"print(\"Dataframe Generated.\")"
],
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Graph Generated.\n",
"Dataframe Generated.\n"
]
}
],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Testing optimized backdoor search\n",
"\n",
"In this section, we compare the runtimes for causal identification using vanilla backdoor search and the optimized backdoor search."
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Time taken for initializing model = 0.10432791709899902\n",
"Time taken for vanilla identification = 0.5290114879608154\n",
"Time taken for optimized backdoor identification = 0.2413492202758789\n"
]
}
],
"source": [
"start = time.time()\n",
"\n",
@ -96,55 +108,51 @@
"identified_estimand = model.identify_effect(optimize_backdoor=True)\n",
"end = time.time()\n",
"print(\"Time taken for optimized backdoor identification =\", end-time2)"
],
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Time taken for initializing model = 0.07566142082214355\n",
"Time taken for vanilla identification = 6.404623508453369\n",
"Time taken for optimized backdoor identification = 1.3513822555541992\n"
]
}
],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It can be observed that the optimized backdoor search makes causal identification significantly faster as compared to the vanilla implementation."
],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [],
"metadata": {}
]
}
],
"metadata": {
"orig_nbformat": 4,
"interpreter": {
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.6.9",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"file_extension": ".py"
"pygments_lexer": "ipython3",
"version": "3.8.5"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3.6.9 64-bit"
},
"interpreter": {
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": true,
"skip_h1_title": true,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}

Просмотреть файл

@ -20,6 +20,8 @@ advanced_notebooks = [
"dowhy-conditional-treatment-effects.ipynb",
"dowhy_refuter_notebook.ipynb",
"DoWhy-The Causal Story Behind Hotel Booking Cancellations.ipynb", # needs xgboost too
# will be removed
"dowhy_optimize_backdoor_example.ipynb"
]
# Adding the dowhy root folder to the python path so that jupyter notebooks