Sitemap
TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Causal Inference

Answering causal questions with Python

9 min readOct 15, 2021

--

This is the second post in a series of three on causality. In the last post, I introduced this “new science of cause and effect” [1] and gave a flavor for causal inference and causal discovery. In this post, we will dive further into some details of causal inference and finish with a concrete example in Python.

Where to start?

In the last post, I discussed how causality can be represented mathematically via Structural Causal Models (SCMs). SCMs consist of two parts: a graph, which visualizes causal connections, and equations, which express the details of the connections.

To recap, a graph is a mathematical construction consisting of vertices (nodes) and edges (links). Here, I will use the terms graph and network interchangeably. SCMs use a special kind of graph called a Directed Acyclic Graph (DAG), for which all edges are directed and no cycles exist. DAGs are a common starting place for causal inference.

Press enter or click to view image in full size
An example causal network. Image by author.

Bayesian vs Causal Networks

--

--

Shaw Talebi
Shaw Talebi

Written by Shaw Talebi

Data Entrepreneur | PhD, Physics

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.