Establishing Causality: An AI and Machine Learning Perspective
In the age of big data and artificial intelligence, establishing causal relationships between events has taken on new importance and complexity. While traditional statistical methods for causal inference remain foundational, machine learning and AI techniques are increasingly being applied to automate and scale the process of determining what causes what.
As an AI and ML expert, I find this merging of causal inference and machine learning to be one of the most exciting areas of research today. The potential impacts span countless domains, from marketing and business to healthcare and public policy. At the same time, there are significant challenges and risks involved in automating such a nuanced task.
In this post, we‘ll explore the intersection of AI, ML, and causality in depth. I‘ll share:
- Key concepts in causality and why it matters
- The strengths and limitations of AI for causal inference
- Cutting-edge techniques and real-world case studies
- The future outlook for "causal AI"
Whether you‘re an AI practitioner, data scientist, or business leader, understanding the role of AI in establishing causality is essential in our data-driven world. Let‘s dive in.
Why Causality Matters
At its core, establishing causality is about understanding the true relationships between variables. When we know what causes what, rather than just what is correlated with what, we gain the power to make better predictions, decisions, and interventions.
Imagine an ecommerce company that wants to optimize its digital marketing strategy. They may observe that customers who view a certain ad campaign tend to make more purchases. But is the ad actually causing the increased sales? Or are customers who are already more likely to buy also more likely to view the ad? Without establishing the causal relationship, the company risks wasting money on ineffective campaigns.
Now consider a healthcare setting. A doctor may notice that patients who take a certain medication have better outcomes. But is the medication responsible for the improvement? Or are healthier patients more likely to be prescribed the medication in the first place? The answer has major implications for treatment decisions and patient care.
As these examples illustrate, confusing correlation for causation can lead to costly mistakes and missed opportunities. Rigorously establishing causal relationships is critical for making sound decisions in virtually every domain.
Correlation vs Causation
To establish causality, we must go beyond simply observing correlations between variables. Two variables are correlated if they tend to change together in a related way. But as the common refrain goes, "correlation does not imply causation."

Source: xkcd
There are many reasons why two variables may be correlated without a causal relationship, such as:
- Coincidence: The correlation is simply due to random chance.
- Reverse causation: The assumed effect is actually causing the assumed cause, rather than vice versa.
- Confounding: A third hidden variable is causing both the assumed cause and effect, creating a spurious correlation.
To determine causality, we need to rule out these alternative explanations and isolate the impact of the potential cause on the effect. This requires carefully designed studies and analytical methods.
The Gold Standard: Randomized Controlled Trials
The most reliable way to establish causality is through a randomized controlled trial (RCT). In an RCT, subjects are randomly assigned to treatment and control groups. The only difference between the groups is exposure to the treatment. This allows researchers to isolate the causal effect of the treatment by comparing outcomes between the equivalent groups.

RCTs are considered the gold standard for causal inference because randomization balances both observed and unobserved confounders across the groups. The main drawbacks are that RCTs can be expensive, time-consuming, and sometimes unethical or impractical to conduct, such as in many healthcare situations.
Establishing Causality with Observational Data
In many real-world scenarios, we don‘t have the luxury of running a randomized trial. We must instead rely on historical data collected from passive observation. With this type of observational data, we can‘t assume the treatment and control groups are truly equivalent. There may be systematic differences that explain the observed outcomes.
However, there are a variety of statistical techniques that can be used to strengthen causal inference with observational data:
1. Controlling for Confounders
One approach is to identify and control for potential confounding variables that may be influencing both the treatment and outcome. This can be accomplished through methods like:
- Regression analysis: Including the confounders as covariates in a regression model
- Stratification: Dividing the data into homogeneous subgroups based on the confounders
- Matching: Pairing treatment and control observations that have similar values for the confounders

2. Propensity Score Matching
Propensity score matching (PSM) is a popular technique for causal inference with observational data. It attempts to mimic randomization by creating balanced treatment and control groups based on the probability of receiving the treatment, known as the propensity score.
PSM involves the following steps:
- Estimate propensity scores for each observation using a model that predicts treatment assignment based on observed covariates
- Match treatment and control observations that have similar propensity scores
- Assess balance and overlap of propensity scores across groups
- Estimate the average treatment effect on the matched sample

While PSM can help address confounding, it relies on the strong assumption that all relevant confounders have been measured and included in the propensity score model. Unobserved confounders can still bias the results.
3. Instrumental Variables
Instrumental variables (IV) are a key tool in the causal inference toolkit. An instrument is a variable that is:
- Correlated with the treatment
- Independent of confounders
- Only impacts the outcome through its effect on the treatment
Intuitively, the instrument mimics a randomized assignment to the treatment, allowing for unbiased estimates of causal effects. Common instruments are based on natural experiments or arbitrary thresholds that influence treatment but are not related to the outcome.

IV methods rely on several strong assumptions that can be difficult to verify in practice. The estimates also only apply to the subset of the population whose treatment status can be influenced by the instrument. However, IV remains a powerful tool for causal inference when a valid instrument is available.
The Role of AI and Machine Learning
With the rise of big data and AI, there is growing interest in leveraging machine learning techniques for causal inference. ML is well-suited for modeling complex, nonlinear relationships and efficiently handling large, high-dimensional datasets. Some key areas of research include:
Causal Discovery Algorithms
Causal discovery aims to learn the underlying causal graph that generated the observed data, indicating which variables are causes vs effects. Several algorithms have been developed to automatically detect causal relationships under certain assumptions, such as the PC algorithm, FCI, and GES.

These algorithms search for patterns of conditional independence in the data that imply particular causal structures. While promising, causal discovery relies on strong assumptions like the causal Markov condition and faithfulness that may not always hold in reality.
Causal Representation Learning
Rather than explicitly specifying a causal model, representation learning techniques aim to learn feature representations that encode causal knowledge directly from data. For example, the Deconfounder algorithm proposed by Wang & Blei 2019 uses unsupervised learning to infer substitute confounders from high-dimensional data.
Other approaches like Invariant Causal Prediction focus on learning representations that lead to predictors robust to distributional shifts, reflecting stable causal relationships. The hope is that AI systems can learn causal structure simply by interacting with their environment, similar to how humans acquire causal knowledge.
ML-Based Estimators
Machine learning models are increasingly being adapted as powerful estimators for causal effects. For example, tree-based methods like causal forests and Bayesian Additive Regression Trees (BART) can flexibly model heterogeneous treatment effects across subpopulations.
Deep learning models like TARNet and Dragonnet leverage the expressiveness of neural networks to estimate individual-level causal effects. They aim to construct balanced representations of the treatment and control groups in order to identify the impact of the treatment.

While highly flexible, these ML-based estimators can be sensitive to model misspecification and require careful validation and interpretation. Ongoing research aims to make them more robust and externally valid.
Real-World Case Studies
Digital Marketing Attribution
In digital marketing, a key challenge is attributing credit for a conversion (e.g. a sale or signup) to the various ads and touchpoints a user was exposed to. Simple heuristics like last-touch attribution can be misleading as they ignore the incremental impact of earlier exposures.
Causal inference techniques like propensity score matching and Shapley value-based attribution have been applied to estimate the incremental effect of each ad on conversion probability. For example, Ren et al. 2018 used an RCT to validate that a Shapley value model estimated the causal effects of ad exposures more accurately than standard heuristics.

Applying causal inference techniques can help marketers more effectively allocate their ad budgets by identifying which touchpoints are truly driving incremental conversions. However, issues like survivorship bias and missing data pose ongoing challenges for attribution modeling.
Personalized Medicine
In healthcare, establishing the causal effects of treatments on patient outcomes is crucial for informing personalized treatment decisions. Observational health data poses challenges due to confounding by indication, as treatments are not randomly assigned but influenced by patient characteristics.
Alaa & van der Schaar 2018 proposed a deep learning model called the Counterfactual Gaussian Process (CGP) for estimating individual treatment effects (ITE) across time from observational data. The CGP handles time-varying confounders and treatment assignments by modeling patient progression over time and adjusting for covariate shift between the treatment groups.

The authors demonstrated that the CGP could accurately estimate ITEs and inform optimal treatment policies in a real-world dataset of sepsis patients. Such personalized causal models could help doctors tailor treatments to individual patients and improve care outcomes.
Looking Ahead: The Future of Causal AI
As we‘ve seen, AI and ML are playing an increasingly important role in causal inference, powering new techniques for automated causal discovery, representation learning, and effect estimation. Looking ahead, I believe causal reasoning will be an essential capability for AI systems to interact with the world reliably and ethically.
Some key open challenges and opportunities include:
- Bridging causal inference with reinforcement learning to create agents that can reason about the effects of their actions
- Developing more sample-efficient and robust methods for estimating causal effects from limited, noisy data
- Incorporating prior knowledge and theories into causal learning algorithms
- Establishing best practices for testing, validating, and auditing causal AI systems
At the same time, we must be cautious about over-relying on AI for high-stakes causal questions. The societal impacts of AI systems making decisions based on causal assumptions are significant. We need human oversight and clear accountability measures to ensure responsible use.
Ongoing research at the intersection of causal inference and machine learning holds great promise. By combining the strengths of data-driven learning with principled causal reasoning, we can develop AI systems that are more robust, adaptive, and aligned with human values. The ultimate goal is to create AI that can establish causal knowledge to reliably predict the effects of actions and interventions – a key step towards beneficial AI for the real world.