Skip to content
Submodule
causalis.scenarios.uplift.model

model

Submodule causalis.scenarios.uplift.model with no child pages and 2 documented members.

Functions

Jump directly into the documented functions for this page.

1 items

Data

Jump directly into the documented data for this page.

1 items
function
causalis.scenarios.uplift.model.predict_cate

predict_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:

τ(x)=E[Y(1)Y(0)X=x]\tau(x) = \mathbb{E}[Y(1) - Y(0) \mid X = x]

Under the assumption of unconfoundedness (no unmeasured confounders), this can be estimated as:

τ(x)=E[YX=x,D=1]E[YX=x,D=0]\tau(x) = \mathbb{E}[Y \mid X = x, D = 1] - \mathbb{E}[Y \mid X = x, D = 0]

The estimator $\hat{\tau}(x)$ used here is:

τ^(x)=g^1(x)g^0(x)\hat{\tau}(x) = \hat{g}_1(x) - \hat{g}_0(x)

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.IRM object. 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

np.ndarray

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

Mathematical NoteParametersReturnsNotesExamples
Link to this symbol
data
causalis.scenarios.uplift.model.__all__

__all__

Value: ['predict_cate']

[‘predict_cate’]

Canonical target

causalis.scenarios.uplift.model.__all__

Link to this symbol