# Causal AI for readmission
URL: https://docs.datarobot.com/en/docs/api/dev-learning/accelerators/model-building-tuning/causal-ai.html

> Work with data recording hospital readmission outcomes for diabetes patients to evaluate the causal relationship between the diabetes patients' medication status and their subsequent chance of being readmitted to the hospital.

# Causal AI for readmission

[Access this AI accelerator on GitHub](https://github.com/datarobot-community/ai-accelerators/blob/main/use_cases_and_horizontal_approaches/Causal_AI/Causal_AI.ipynb)

Predictive AI models are a powerful tool for uncovering subtle predictive relationships between observed variables. But sometimes, you need to draw conclusions about the causal relationship between two variables, not just the observed correlation. To achieve this "Causal AI", you can use the DataRobot platform and a quasi-experimental technique called "Inverse Propensity of Treatment Weighting". This notebook will apply this technique to data on diabetes hospital patient readmission.

This notebook outlines how to:

- Prepare data for a Propensity of Treatment model
- Fit a Propensity of Treatment model with DataRobot
- Calculate Inverse Propensity of Treatment Weights
- Evaluate the causal relationship using Inverse Propensity of Treatment Weighting
- Understanding Inverse Propensity of Treatment Weighting

In this notebook, you will be working with data recording hospital readmission outcomes for diabetes patients. You will evaluate the causal relationship between the diabetes patients' medication status and their subsequent chance of being readmitted to the hospital.

To evaluate this causal relationship experimentally, you would have to randomly assign patients to the treatment group (those receiving medication) vs. not, and then follow those patients to see whether they get readmitted to the hospital or not. But in the scenario for this notebook, you don't have experimental data! You only have observational data. In other words, some patients walk in taking medication, others don't. You have not controlled the assignment of the "treatment" condition (medication) to the subjects of the study. So while you could use predictive modeling to understand if the medication status of patients walking in is predictive of later readmission, you can't directly use predictive models to make conclusions about whether the medication has a causal effect on readmission.

In this scenario, you can use a "quasi-experimental" technique; this is a set of techniques for approximating experimental setups without actually having a true experiment. Specifically, you can use a technique called "Inverse Propensity of Treatment Weighting".

Inverse Propensity of Treatment Weighting consists of the following steps:

1. Fit a predictive model to estimate the probability for each study participant being assigned to the treatment group (their "propensity of treatment").
2. Calculate a special weight for each participant based on their propensity of treatment (the "inverse propensity of treatment weight"), which will adjust the treatment and control groups to become more similar to each other in terms of the observed confounding variables.
3. Evaluate the causal relationship between the treatment and the outcome using the adjusted/weighted populations (pseudopopulations).
While this technique is not as valid as the gold standard of a randomized controlled trial, it can bring you a lot closer to obtaining comparable treatment and control groups from which to judge a causal relationship.

---
