causalis.scenarios.uplift.model.predict_catepredict_cate
Predict Conditional Average Treatment Effect (CATE), or uplift, for new observations.
This function implements a “lazy” T-learner approach. On its first call for a given
fitted :class:~causalis.scenarios.unconfoundedness.model.IRM model, it trains two
separate full-sample outcome models—one for the control group ($D=0$) and one for the
treatment group ($D=1$). These models are then cached on the irm_model object for
subsequent calls.
Mathematical Note
The CATE at a point $x$ is defined as the difference in potential outcomes:
Under the assumption of unconfoundedness (no unmeasured confounders), this can be estimated as:
The estimator $\hat{\tau}(x)$ used here is:
where $\hat{g}_1$ is a machine learning model (cloned from irm_model.ml_g) trained
on the subset of the original training data where $D_i = 1$, and $\hat{g}_0$ is
similarly trained on the subset where $D_i = 0$.
Parameters
- irm_modelIRM
A fitted :class:
~causalis.scenarios.unconfoundedness.model.IRMobject. The model must have been fitted using :meth:~causalis.scenarios.unconfoundedness.model.IRM.fit.- Xpd.DataFrame or np.ndarray
New observations for which to predict the CATE. If a DataFrame, it must contain the same confounder columns as used during fit. If an ndarray, it must have the same number of columns as the fitted confounders.
Returns
A 1D array of predicted CATE/uplift values for each row in X.
Examples
Generate data
Notes
The models trained for prediction use the full sample (split by treatment arm)
available at fit time, whereas the :meth:~causalis.scenarios.unconfoundedness.model.IRM.fit
method uses cross-fitting for nuisance estimation.
Canonical target
causalis.scenarios.uplift.model.predict_cate
Sections