causalkit.inference.cate_esimand#
- causalkit.inference.cate_esimand(data, ml_g=None, ml_m=None, n_folds=5, n_rep=1, use_blp=False, X_new=None)[source]#
Estimate per-observation CATEs using DoubleML IRM and return a DataFrame with a new ‘cate’ column.
- Parameters:
data (CausalData) – A CausalData object with defined outcome (outcome), treatment (binary 0/1), and confounders.
ml_g (estimator, optional) – ML learner for outcome regression g(D, X) = E[Y | D, X] supporting fit/predict. Defaults to CatBoostRegressor if None.
ml_m (classifier, optional) – ML learner for propensity m(X) = P[D=1 | X] supporting fit/predict_proba. Defaults to CatBoostClassifier if None.
n_folds (int, default 5) – Number of folds for cross-fitting.
n_rep (int, default 1) – Number of repetitions for sample splitting.
use_blp (bool, default False) – If True, and X_new is provided, returns cate from obj.blp_predict(X_new) aligned to X_new. If False (default), uses obj._orthogonal_signals (in-sample estimates) and appends to data.
X_new (pd.DataFrame, optional) – New covariate matrix for out-of-sample CATE prediction via best linear predictor. Must contain the same feature columns as the confounders in data.
- Returns:
If use_blp is False: returns a copy of data.df with a new column ‘cate’. If use_blp is True and X_new is provided: returns a DataFrame with ‘cate’ column for X_new rows.
- Return type:
pd.DataFrame
- Raises:
ValueError – If treatment is not binary 0/1 or required metadata is missing.