Episode 131: Building a Causal Mindset in a Predictive World

Download MP3

[00:00:00] Dr Genevieve Hayes: Hello, and welcome to Value Driven Data Science, where data professionals become strategic experts. I'm your host, Dr. Genevieve Hayes, and today I'm joined by Dr. Quentin Gallea. Quentin is the founder of The Causal Mindset and the author of The Causal Mindset Handbook. He has taught causal thinking to thousands of practitioners worldwide, including from top tech companies, and advises C-suite and data leaders on causal inference and AI impact.
[00:00:34] In this episode, we'll explore how causal AI combines causal inference and predictive AI to enable better decision-making than either of its components can alone. Quentin, welcome to the show.
[00:00:48] Dr Quentin Gallea: Thank you very much. It's a huge pleasure to be here and to discuss my passion, my obsession, and my expertise with you and your audience.
[00:00:57] Dr Genevieve Hayes: Machine learning models are designed to predict outcomes. Given the characteristics of a customer, a machine learning model can, for example, predict whether they'll buy a product, click on a link, cancel a service, or claim on their insurance. But what an ML model can't tell you is what causes the customer to do any of these things, and what would happen if an organization intervened to change their behavior.
[00:01:25] This is because ML models are correlation-based, and as I'm sure all our listeners know by now, correlation is not equal to causation. To understand what causes a person to act in a certain way, it's necessary to look beyond ML to causal inference. But causal inference and ML aren't competitors. Data scientists don't have to choose one or the other.
[00:01:47] In fact, ML and causal inference can be combined in the form of causal AI to give executives the power to make decisions based on causation, not just correlation, at scale. That said, most organizations are still catching up with recent advances in predictive AI in the form of LLMs, so haven't had the time to even consider causal AI.
[00:02:13] And many data scientists are so caught in the predictive mindset instilled during their training, they struggle to think any other way. So before we get into how causal AI combines predictive AI with causal inference, I'd like to take a step back and explore what a causal mindset actually involves.
[00:02:33] Quentin, your business is called The Causal Mindset. What does a causal mindset mean in practice for a data scientist, and how does it differ from a predictive one?
[00:02:44] Dr Quentin Gallea: So what is fascinating is that indeed these fields are grounded in statistics and math, and it's a necessary step. But math and statistics are here to enlighten and not obscure. And the thing is, you can go very far already with just a mindset change. The way you challenge the data, the way you challenge the evidence that are served to you.
[00:03:08] And so the causal mindset came from this observation that math and statistics tend to obscure decision-making, and even it made it complex to enter the field of causal inference. So I stepped back, and I started by teaching in a more abstract, non-technical way first, even to very experienced data scientists, even to very experienced researchers in medical sectors, for example, where there is a long expertise.
[00:03:33] I would step back and start by just helping them to think causally about things. And the thing is, if you understand the concepts in causal inference in a non-technical way, it helps tremendously even to apply then the right technical approach. And so to build the causal mindset.
[00:03:53] I actually start with the foundation. The foundation is really this basis of causal inference and the main challenge in causal inference, which is called the fundamental problem of causal inference. Ideally to infer causality, we need to have two parallel worlds.
[00:04:10] One when you take the action, and the other where you don't. It could be, for example, with a marketing campaign, what will happen in the world if you spend a certain amount on the marketing campaign, or what will happen in the very same world without the spend? We never observe both
[00:04:26] Dr Genevieve Hayes: And this is the counterfactual
[00:04:28] Dr Quentin Gallea: Exactly. That's counterfactual, and we never observe the counterfactual.
[00:04:31] Hence it's why it's called counterfactual, because it's counter to the fact. We observe just the factual, what's realized. And this is called the fundamental problem of causal inference. Ideally, what we need to infer causality is unobserved. And so the first thing is to think about this reference point, and when someone serves you basically a causal claim or causal evidence or say because or therefore, the first thing is to pause and think, "Okay, what is the reference point?
[00:04:59] What do they use to proxy this counterfactual?" So in an AB testing, in a randomized control trial, you have a control group. You have, for example, a group that is not exposed to the treatment, and ideally that have shared the same characteristics on average. But then it's not that simple. You can still ask for example, the validity of this group.
[00:05:20] In many situations, we also don't have randomized experiments. There are other pieces of evidence. And what I show to build this causal mindset the very first step, is always ask when you hear or even say or read because or therefore, just stop and ask, "Is there something else? Is there something else explaining the effect or affecting this effect?"
[00:05:43] That's basically what we call confounders, is when you have a common cause to the cause of interest and the outcome you observe. And the first thing to build a causal mindset is basically to flag when you want to answer causal questions and how to challenge these questions. That's the very first step because prediction can be incredibly useful, but we have to differentiate with causal questions.
[00:06:07] As soon as you think about impact, you're curious about causal inference and measuring causal impact. And already distinguishing between the two is incredibly useful to ensure that you use the right toolkit, and this is valid for data scientists. This is valid for the leadership, for executive, such that they ask for the right tools.
[00:06:27] Dr Genevieve Hayes: Now, most data science training programs are typically very ML-focused. So as I mentioned in the intro, most data scientists are naturally going to have a predictive mindset. What are some of the common mistakes or misconceptions you see people making when transitioning from predictive to causal thinking?
[00:06:47] Dr Quentin Gallea: Yeah, it's really the main thing I'm doing these days is helping experts, people who spent a lot of time in predictive inference transition to causal thinking. And indeed, the thing is that habits and the way we evaluate typically predictive models can completely backfire when it comes to causal inference if you apply the same methods.
[00:07:07] So why is that? So the first thing is, as you said also, it helped me to connect the two and to help differentiate. The first thing is a predictive model. Usually you Observe the ground truth. In many cases, you train a model, you have some labels, for example, of some features and some outcome, and you know the ground truth, and you can train to predict this ground truth in many situations.
[00:07:32] In causal inference, it does not happen. So it's already something that is very puzzling for people because they are like, "Where is the training set? H-how can I train my model?" In the end, we don't know the ground truth, and that's something that's might seem scary in the beginning, but that's how it is.
[00:07:47] And to build a causal model, you need to have knowledge about the world. You need to draw what we call a directed acyclic graph or a directed graph that represents the causal pathway between different elements, all your features that you care about. You want to measure the effect of X on Y, and you need to basically understand how X might affect Y, but also what are the common cause and common consequences and other different things.
[00:08:16] That's the first step. Why I'm telling you this? Because based on this graph and knowledge of the world, you will select some features that you want to include in the model or not. Some features should be included, confounders, because the idea is to disentangle the effect from your main cause of interest from these confounders, this common cause, to go from correlation to a causal ef-effect, actually.
[00:08:42] And there are some features that you should never include because they will create spurious correlation. They will bias the estimation from a causal perspective if you include them. For example, colliders. Colliders are common consequences of X and Y, your cause of interest, your treatment variable, and your outcome.
[00:09:01] And so the thing is, if you approach the question of causal inference with a predictive mindset, the first thing is that you might want to select the features based on predictive power. But that does not work because you might select features that are very strong predictive power that you should never include.
[00:09:16] For example, a collider. A collider is typically, again, a consequence. It might be a symptoms of your outcome, so it's a consequence, and it might be a very good predictor. So symptoms are usually very good predictor of a problem. For example, in the medical sector, you can really use sy-symptoms to predict diseases, but again, they are consequences, not causes.
[00:09:38] And from a causal inference perspective, if you include these features in the model, it will completely backfire. You can increase the predictive power, but completely bias the causal estimation of your treatment on the outcome. So the very first thing is the way you select features is completely different, and you can introduce predictive power.
[00:09:58] So a strong predictor might be something that you must exclude from the model, and this is just based on domain knowledge, the decision. The second is that something that have very weak predictive power, and eventually will not change some metrics like adjusted R square or It's not statistically significant in the linear regression, for example.
[00:10:20] These features might be essential to include. Why? Because again, you might have a confounder, so something that is a common cause between your treatment and outcome, and you must include this one to unbias your coefficient of interest, the effect of the treatment. And maybe itself in the model, this common cause is not statistically significant, will not really increase predictive power, but it does not matter.
[00:10:45] What matters is the effect on your treatment coefficient. So people might select features based on predictive power in causal inference, and that might completely backfire
[00:10:54] Dr Genevieve Hayes: Okay. I'm just trying to get my head around this.
[00:10:57] Dr Quentin Gallea: Please
[00:10:58] Dr Genevieve Hayes: All right, so something can have strong predictive power, it could be a confounder that's creating the false sense that there's some sort of causal relationship, and that might be something like both , the murder rate and ice cream sales are highly correlated because both of them increase during hot weather.
[00:11:19] You wouldn't use ice cream sales in order to predict the murder rate, even though presumably if you put them in some sort of correlation-based model, ice cream sales would have high predictive power on the murder rate. So I think that's what you're saying with the first one. Although I would take a step back and argue that you wouldn't want to include that in a predictive model anyway just because it doesn't make sense, and you'd probably get a multicollinearity problem going there anyway.
[00:11:49] But I'm still trying to get my head around , including factors that might not necessarily have strong predictive power if they were put in a predictive model. Could you give an example of that?
[00:12:02] Dr Quentin Gallea: Yeah of course. That's a great point because indeed it's puzzling. So first, basically, if we step back and start from the beginning, you want to measure the effect of marketing spend on sales.
[00:12:15] The thing is, marketing spends and sales are confounded. If you just look at the correlation, typically the return on investment from this marketing spend will be inflated, will be overestimated, it will be biased due to seasonality. Why? Because seasonality is a confounder. It's a common cause. You have some seasonal spikes that will boost demand, and hence sales, the outcome.
[00:12:39] But at the same time, you might spend more on marketing when demand is high, like near Christmas. So the thing is, this is a confounder. If you just look at the relationship between sales and marketing spends, you will overestimate the return on marketing investments because it's confounded with seasonality.
[00:12:57] So the first thing is at least to control for seasonality. There are many ways to isolate the effect of seasonality. So we want to include this seasonality because it's a confounder. Let's say for a moment that in this hypothetical example that you have some features in your model that control for time capturing seasonality.
[00:13:17] And this control in your model, let's say a simple linear regression model, is not statistically significant. The thing is, most people will look in the wrong place. They will look at statistical significance of the control variable. But what happens is that you should look at the coefficient. The goal of including seasonality is not to look at seasonality.
[00:13:37] The goal of including seasonality in the model is to unbias your coefficient of marketing spend on sales. So what happens is the features capturing seasonality are not statistically significant, and have a low predictive power. They will not change much quality of the prediction metrics, but they might change the coefficient on marketing spend.
[00:13:57] And let's say marketing spend, the coefficient was one, and once you include seasonality, it's zero point five because it was inflated before. And once you include seasonality, despite the fact that it's not statistically significant, it might unbias, and typically here it will tend to cut the coefficient of interest.
[00:14:15] We care about an unbiased effect of the coefficient of interest in causal inference. So that's a typical example why you might have a feature that is important. On its own, it looks like it's not important because it will not increase predictive power much, or even virtually not changing predictive power.
[00:14:32] It might not be statistically significant, but we look in the wrong place. We need to look at the coefficient of interest, which is our cause of interest here, marketing spend. And here the coefficient might change and this change is what matters
[00:14:44] Dr Genevieve Hayes: And this is all because we're trying to isolate the treatment effect, isn't it?
[00:14:47] The end of the day, we're not dealing with randomized controlled tests, but we're trying to get us back to the situation where our two groups are as similar as possible. So we need to remove anything that makes them different.
[00:15:00] Ah, yes, I'm getting that
[00:15:02] Dr Quentin Gallea: Exactly. And related to this you might have a fantastic causal inference model with a very low predictive power. You might have a great model or in causal inference that might have an adjusted R square of five percents. It just means that the cause you're trying to isolate explain a small part of the variance.
[00:15:22] But typically, if you want to explain human behavior, it might be the case. Your marketing campaign, your training might explain just 5% of the variation of the outcome, but it's not a problem. The idea is to measure properly your causal effect, and this causal effect might just explain a small share of the variance, but that's fine.
[00:15:42] The goal is not to predict everything. It's not to explain all the causes at the same time. It's to pin down precisely in a non-biased way one cause at a time. That's causal inference.
[00:15:54] And so a model with a relatively low predictive power might be great from a causal inference per-perspective
[00:16:00] Dr Genevieve Hayes: And taking this back to university statistics, at the end of the day, causal inference is hypothesis testing. Is that right?
[00:16:08] Dr Quentin Gallea: So in the end, we do use extensively hypothesis testing to test our evidence in different form. But the thing is that I want also to insist here related to hypothesis testing is basically in causal inference, you have no test. It does not exist a test that will tell you if your evidence is causal or not.
[00:16:26] And that's very important because there's no way to solve the absence of the parallel world of the counterfactual. So in the end, the data and statistics cannot either prove if the effect is causal or not. The effect is always eventually causal under some assumptions.
[00:16:41] Some assumptions you can test directly and some you can't. And some of the key assumptions to make an effect causal usually are not testable because we don't observe the counterfactual.
[00:16:52] And that's unsettling, right? Because you would like to say, "Okay I just want to test if it's causal and look at the stars or P values."
[00:17:00] Does not exist. You can do many things to go in this direction to increase your certainty, to evaluate the uncertainty, to gain confidence in the results. There are many different tests, but you don't have a simple general test that will tell you causal, not causal.
[00:17:15] Dr Genevieve Hayes: Okay. And now this is a question that I really wanna know the answer to. I wanna ask questions about causal AI which is a relatively new development, and I have to confess that the first time I ever heard someone mention it, I thought it was just causal inference rebranded for the AI era.
[00:17:32] But I now realize that's not the case at all. So what is the difference between causal inference and causal AI?
[00:17:39] Dr Quentin Gallea: Fantastic. And indeed it puzzles many people, and actually I spend a lot of time online correcting people because they misunderstood what it is, and typically they will use machine learning to do causal inference. It's not that. The first thing is that causal machine learning, Causal AI, is not using machine learning simply blindly to do causal inference, because as you said in the introduction, machine learning detect pattern, use correlations, and hence correlation does not imply causation.
[00:18:03] So it's not the right toolbox to infer causality. So what is it? What is causal machine learning? So machine learning is great to deal with high dimensional data, and in a nonparametric way, or in a very flexible way when you don't have to structure the functional forms assumption, or at least with very flexible functional form assumptions, to a very complex, functional form.
[00:18:27] I think it will be clearer if I give very precisely examples of causal ML. So a common problem in causal inference Again, the basic idea, for example, when you work with observational data and you want to infer causality, the basic problem is that you have to control for all the confounders.
[00:18:48] So you have to include in your model all these common causes. And what many people do blindly, they will just include linear controls. They will select all the confounders, say, "Okay, I observe this, I include them in my model," typically a linear regression model, and all these controls are linear controls.
[00:19:07] The thing is, this is a very strong functional form assumption. You impose to your model to have all these confounders with a linear effect. And the thing is, if the form of the set of confounders, what we call the nuisance function, because it's basically noise that affect, that bias the result.
[00:19:24] If you have a misspecification of the functional form of this function, it will bias the estimation, and it can bias actually terribly. So you can control for the correct confounders, but if the functional form assumption is wrong, it can create too huge bias. So it's really an important question. So traditionally, you need to do feature engineering if you want, or exploratory data analysis.
[00:19:46] You have to study the relationship between all these confounders and your variable of interest, the cause and the outcome. But this is time-consuming, it's a bit boring, and it might lead to P-hacking because basically you have many different degrees of freedom. It's never good for researchers or data scientists when they have too many degrees of freedom, so they can cherry-pick.
[00:20:08] So this is a great job for machine learning. One example of an algorithm that is used in causal ML is called double machine learning. Double ML, the goal is that you say, "Okay, these are my confounders. I have five confounders, but I'm agnostic.
[00:20:23] I don't know their effect, how the functional form is on the outcome. I just know they are confounders, and I want to control for them, but I'm not sure if it's linear, quadratic, higher polynomial, or whatever form." And what you do is that you select the features, and you give this task of finding the best functional form to a machine learning algorithm.
[00:20:44] And here you avoid all the mistakes I mentioned before because you're not selecting the features based on predictive power. You just try to fit the best functional form using the features you defined, on this causal model. And so instead of saying, okay, is there a linear or quadratic, you let, for example, even nonparametric model like random forest or XGBoost or even a neural net find the best functional form of these confounders on the treatment and the outcome, and you can use this basically to clean these nuisance to basically disentangle the effect of this nuisance function from your effect of the treatment on the outcome.
[00:21:21] And so that's an example of causal machine learning, is you start with causal inference. You build your model, you select your treatment, your outcome, the confounders in a causal inference way, and then you just ask machine learning to deal with the functional form of the controls
[00:21:38] Dr Genevieve Hayes: Okay. And so what's the output of the model at the end?
[00:21:41] Dr Quentin Gallea: As usual, the goal in causal inference is basically to have an unbiased coefficient of your treatment on your outcome. So usually you don't even look at the estimation of this nuisance function. You usually don't even try to interpret the coefficient. The only goal is to clean your effect from your treatment, to your outcome from this nuisance function.
[00:22:02] So usually you're just using a first step to disentangle the effect from all these confounders.
[00:22:09] Dr Genevieve Hayes: Ah, okay. I was under the impression that it was using machine learning to automate causal inference
[00:22:16] Dr Quentin Gallea: So , of course, everybody's about not necessarily machine learning, but about gen AI. Many people with LLMs want to automate everything, including causal inference. And I would also put this into the causal AI realm, is all the potential, the experimentation to automate causal inference with LLMs.
[00:22:35] So that's a different thing. But usually it's something that is less convincing and so less used in practice. While double machine learning is really widely used in practice and you have very clear gains and evaluation metric, and guardrails also to avoid overfitting and all these things with different methods.
[00:22:52] So double machine learning is really something that's widely used
[00:22:56] Dr Genevieve Hayes: So how do causal inference and causal AI change the conversation a data scientist can have with an executive? For example, is there anything they can say now that they couldn't say when working with predictive models alone?
[00:23:11] Dr Quentin Gallea: So the main change we have to do as data scientists is really educate the executive to understand the difference between causal inference and predictive inference. The thing is, if you say causal inference, predictive inference, in particular causal inference, people might be scared, might think it's complex, in particular leadership or executive.
[00:23:29] So causal AI is a good PR stunt to basically engage in this conversation and say, "Okay, there's this really nice toolbox, and it helps to answer all these important business questions." So usually I work a lot with executive , for example, in top tech companies as well, we tend to have executive that are high data literacy, and they understand the different toolbox.
[00:23:52] They understand that sometimes they don't know the answer, and they want to experiment to get the answer, hence they want causal inference. And so one thing causal AI change is that it helps to bring awareness just because now there is this new kid on the block and people want to know what is it about.
[00:24:09] But the second thing is it creates some issues from the data scientist perspective because many, and I see many articles online, who people think that now they can just use machine learning for causal inference, and this backfire dramatically due to the misconceptions I've mentioned before.
[00:24:27] Dr Genevieve Hayes: What's one practical thing a data scientist can do tomorrow to start shifting from a predictive mindset to a causal one?
[00:24:34] Dr Quentin Gallea: So of course, I really don't want to self-promote, but I don't have another example actually. I wrote this book, "The Causal Mindset" exactly for this shift because it's really non-technical, so it helps to have the big picture and start right. Aside from this, if you don't want to buy my book, some of the best authors in causal inference share their book for free online.
[00:24:53] And I will mention two, and I will invite people to start reading these books. The first is by Mateus Facohe. It's called "Causal Inference for the Brave and True." It's free and online. The second is by Scott Cunningham, and it's "The Mixtape." Actually, now he has a new version, so it's called "Causal Inference: The Remix," and it's also beautiful book.
[00:25:15] "The Remix" is more academia-oriented, I would say. It's a bit longer and more intensive in math. Mateus is a great first step. Because the first chapter really explain you what's the difference and what is so special about causal inference, what type of questions you want to answer with causal inference, and how it differ from predictive inference.
[00:25:35] So that will be the first step for me. It will be to open these applied books to move to causal inference
[00:25:41] Dr Genevieve Hayes: And for listeners who wanna get in contact with you, Quentin, what can they do?
[00:25:45] Dr Quentin Gallea: So I post almost daily on LinkedIn. LinkedIn is my main platform. They can reach out. I always answer private messages so we can connect. I'm also active on Instagram, TikTok, and YouTube, but slightly less.
[00:25:56] Dr Genevieve Hayes: And that's it for today's episode of Value-Driven Data Science. But if you want more from Quentin, next week you can catch our Value Boost episode where we'll explore how to build a credible causal argument in business settings where true experiments aren't an option. And if you found today's episode useful and think others could benefit, please leave us a rating and review on your favorite podcast platform.
[00:26:22] That way we'll be able to reach more data scientists just like you. Thanks for joining us today, Quentin
[00:26:30] Dr Quentin Gallea: Thank you. It was great pleasure
[00:26:31] Dr Genevieve Hayes: And for those in the audience, thanks for listening. I'm Dr. Genevieve Hayes, and this has been Value-Driven Data Science.

Episode 131: Building a Causal Mindset in a Predictive World
Broadcast by