I recently discovered the concept of "causal inference" and I'm trying to understand if I've grasped its essence correctly. If I understand it correctly, it involves finding what influences the outcome while being able to quantify the importance of each variable. In this sense, how is it different from sensitivity analysis?

There's also something else I haven't been able to fully comprehend from the examples I've seen. With the DoWhy toolbox in Python, it appears possible to construct a relationship graph between the data. Do we need to specify the structure of the graph ourselves, or is it an algorithm that determines it automatically?

Assuming it's the algorithm that determines the graph automatically, can we use this graph as a guideline to build a cascading machine learning model?

thx for highlight


1 Answer 1


Your post has 2 questions, so I will try to answer both:

Difference between Causal Inference (CI) and Sensitivity Analysis (SA).

Sensitivity Analysis (SA) can be described as the following (Naik & Kiran, 2021):

“a popular feature selection approach employed to identify the important features in a dataset. In sensitivity analysis, each input feature is perturbed one-at-a-time and the response of the machine learning model is examined to determine the feature's rank.”

This definition shows that SA gives you a ranked list of the important features in your data, which is very good insights as to which feature to use/focus on (can also do this after feature engineering/transformations to check if they would be useful).

On the other hand, the goal of Causal Inference (CI) requires you to identify a causal graph from your data, which can then be used in your model to A) make predictions and B) query the model for insights that traditional ML methods cannot give, such as interventions.

This causal graph that you need to build explains the cause and effects between the features and the target, and between the features themselves. For example, let’s say we have 2 features X and Z and a target Y. This shows that X directly affects the target, but also indirectly affects the target via the feature Z. It’s this type of information that CI takes into account that SA doesn’t.

example of a graph with 3 nodes: X, Y and Z and 3 relationships X->Y, Z->Y, X->Z

Manual VS automatic graph construction

You can do either manual graph construction, automatic graph construction, or a mix of both!

A manual graph construction implies that you have enough knowledge about your data/domain to create a causal graph yourself (which features impact one another and which impact the target + the relationship of that impact e.g., the direction of the relationship and the type). The goal is to end up with a DAG (Directed Acyclic Graph) with no loops between your features and their connections.

However, you don’t always have this knowledge at hand, so you can do automatic graph construction to get started. To simplify the search space, you can do Sensitivity Analysis to highlight the most important features and focus on the most important ones at first to build your causal graph.

The output of automatic graph construction algorithms is rarely perfect, so this is where the mix of both comes in: you manually fix the automatically created graph with knowledge that you have about your data, which will allow you to correct relationships between your features (correct the direction or the relationship between them). And at the end of the process, you hopefully have a DAG that you can pass to your model along with your data!


I recommend reading the following:

Hope this helps.


Naik, D.L., kiran, R. A novel sensitivity-based method for feature selection. J Big Data 8, 128 (2021). https://doi.org/10.1186/s40537-021-00515-w


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.