This book is aimed at students and practitioners familiar with machine learning (ML) and data science. Our goal is to provide an accessible introduction to causal reasoning and its intersections with machine learning, with a particular focus on the challenges and opportunities brought about by large-scale computing systems acting as interventions in the world, ranging from online recommendation systems to healthcare decision support systems. We hope to provide a practical perspective to working on causal inference problems and a unified interpretation of methods from varied fields such as statistics, econometrics and computer science, drawn from our experience in applying these methods to online computing systems.
Throughout, methods and complicated statistical ideas are motivated and explained through practical examples in computing systems and their applications. In addition, we devote a third of the book to discussing machine learning applications of causal inference in detail, in different settings such as recommendation systems, system experimentation, learning from log data, generalizing predictive models, and fairness in computing systems.
Beyond our focus on machine learning applications, we expect that three aspects of our perspective on causal reasoning will be woven throughout our treatment (pun not intended) of this material, to help organize our materials and provide what may be a distinct viewpoint on causal reasoning. While this book is targeted primarily for computer scientists, these aspects may also make the book useful for learners more broadly:
We present a unified view of causality frameworks, including the two major frameworks from statistics (Potential outcomes framework) and computer science (Bayesian graphical models) which are often not presented together. We present how these are compatible frameworks that have different strengths, are appropriate for different stages of a causal reasoning pipeline, and provide practical advice on how to combine them in a causal inference analysis. In addition, by introducing causal inference through the core concepts of interventions and counterfactuals, we introduce causal inference methods from a “first-principles” approach, creating a clear taxonomy of back-door and natural experiment methods and highlighting similarities between various methodologies.
We make an explicit distinction between identification (causal) and estimation (statistical) methods. While this distinction is fundamental to causal reasoning, it is overlooked in many texts on causal inference, preventing readers from understanding the distinction from statistical methods and sources of error in their causal estimate. Through this distinction, we make a natural connection to machine learning: ML can be useful for all statistical parts of causal reasoning, but it is not useful for identification, which follows from causal assumptions, whether implicit or explicit. Throughout the book, we discuss how machine learning can enrich estimation methods by allowing non-parametric estimation, and how causal reasoning can be useful to make ML methods more robust to environmental changes.
Finally, we discuss the criticality of assumptions in any causal analysis and present practical ways to test the robustness of a causal estimate to violation of its assumptions. We refer to this exercise as “refuting” the estimate, in a similar way to how refutation of scientific theories is a common way to test their relevance. Based on our experience, we present different ways to test assumptions, check robustness and conduct sensitivity analysis for any obtained estimate.
Throughout, we will include code examples using DoWhy, a Python library for causal inference.
The current outline of our book is as follows:
PART I. Introduction to Causal Reasoning
We introduce the key concepts behind causal reasoning, organized by the 4 steps of modeling and assumptions; identification; estimation; and refutation. We focus this part on fundamental ideas and abstractions, using simplified examples to provide readers with useful intuitions.
Chapter 1. Introduction
Chapter 2. Causal Models, Assumptions and Identification
Chapter 3. Causal Estimation
Chapter 4. Refutations, Validations, and Sensitivity Analyses
Part II. Methods and Practice
We discuss deeper details of the methods and concepts introduced in Part I. We focus this part on mathematical details, common pitfalls and heuristics that are used in practice, using more detailed examples to provide readers with deeper experience and intuition.
Chapter 5. Identification
Chapter 6. Conditioning-based Methods
Chapter 7. Natural Experiments
Chapter 8. Validating and Refuting Assumptions in Practice
Chapter 9. Practical Considerations
Part III. Applications
We discuss connections between causal inference and core applications in computer science, including experimentation and reinforcement learning; offline learning from logged data; challenges of robustness and generalizability of machine learned classifiers; and the important task of building interpretable and fair machine learning models. In each chapter, we provide a single in-depth example.
Chapter 10. Connections between Causality and Machine Learning
Chapter 11. Experimentation and Reinforcement Learning
Chapter 12. Learning from Logged Data
Chapter 13. Generalization in Classification and Prediction
Chapter 14. Machine Learning Explanations and Bias
We are posting Chapter 1 of our book now, and will be releasing with new chapters regularly. Our texts will often be rough, especially on their initial posting, and we expect they will see substantial change throughout the writing process. We appreciate in advance your patience with our errors and mistakes, as well as your comments and feedback throughout.