intro-to-causal-inference
A introduction to causal inference using common tools from the python data stack
Table of Contents
Getting Started
Install graphviz
You'll need graphviz
for our first exercise notebook, to visualize causal graphs.
- Linux:
- Depending on your distro, here are the possible commands
- MacOS:
- You can easily install it via homebrew:
brew install graphviz
- You can easily install it via homebrew:
- Windows:
- The graphviz.org website has convenient installers for you
Clone the repository
In your terminal, use git
to clone the repo to your machine.
git clone [email protected]:ronikobrosly/causal_inference_intro.git
If you are less comfortable with git
, there is an easy alternative: You can simply download a zip file of it here :)
Determine your installation preference
Now that you've installed graphviz
and cloned the repo locally, there are two paths to finishing up preparing your machine for this tutorial:
pip install
in a virtual virtualenv
Option 1: installing via Create a new virtual environment for this tutorial using this guide. Name your environment intro-to-causal-inference
"Activate" this environment and then run the following command in the root folder of this repo: pip install -r requirement.txt
This will install all the necessary packages for the tutorial.
As an optional step, you can try to run the check_environment.py
file (in the root folder of the repo) while within your virtual environment. You can do so by running python check_environment.py
in your terminal. It will alert you if you're missing any required python packages.
conda
package manager
Option 2: installing via Anaconda python and the If you do not already have the Anaconda distribution of Python 3, please install it.
You can then use the conda
tool in your terminal to install the necessary packages:
conda env create -f conda_env.yml
"Activate" the new environment via:
conda activate intro-to-causal-inference
As an optional step, you can try to run the check_environment.py
file (in the root folder of the repo) while within your virtual environment. You can do so by running python check_environment.py
in your terminal. It will alert you if you're missing any required python packages.
Install a new IPython kernelspec
Once the above is complete, you'll need to run the following commands:
python -m ipykernel install --user --name intro-to-causal-inference --display-name "Python (intro-to-causal-inference)"
Start up jupyter lab and open a notebook
In the terminal, execute jupyter lab
.
Navigate to the notebooks
directory and open your notebook of choice.
Acknowledgements
I would like to like to acknowledgement the following individuals for creating public causal inference materials that were useful in the creation of this tutorial:
- Konstantinos Papadopoulos @ Analytics Mayhem
- Ramin Ghelichi @ Wayfair
Feedback
I love would to hear your feedback on these tutorial materials! Please send your comments to [email protected].