calibratedDML GitHub

Python package

Install calibratedDML and import from calibrateddml. The estimator follows the scikit-learn convention: create an object, call fit(), then inspect the results.

Install

python -m pip install git+https://github.com/Larsvanderlaan/calibratedDML.git

Inputs

X is a two-dimensional covariate array or data frame. A and y are treatment and outcome vectors. Set control_level to choose the arm used in contrasts.

Run the complete example to see the fit and its output.

Use existing predictions

mu_mat and pi_mat contain cross-fitted outcome and propensity predictions, with a column for each treatment level. See supplied nuisance predictions for their definitions.

For other regression targets, use calibrated_linear_functional() with cross-fitted regression and Riesz estimates and a specified linear functional.

Nuisance learners

The core installation includes "mean", "linear", "lasso", and "random_forest". You can also pass scikit-learn estimators directly.

ModelExtra dependencyInstallation
"gam"pygampip install "calibratedDML[gam]"
"boosted_trees"lightgbmpip install "calibratedDML[boosted]"

Results

summary() and to_frame() return result tables; confint() returns confidence intervals. The fitted object also stores the original predictions in mu_mat_ and pi_mat_, and the calibrated predictions in calibrated_mu_mat_ and calibrated_pi_mat_.

Options and defaults · Full Python API · Tutorials