MetaLearners for CATE estimation
Project description
metalearners
MetaLearners for Conditional Average Treatment Effect (CATE) estimation
The library focuses on providing
- Methodologically sound cross-fitting
- Convenient access to and reuse of base models
- Consistent APIs across Metalearners
- Support for more than binary treatment variants
- Integrations with
pandas
,shap
,lime
,optuna
and soononnx
Example
df = ...
from metalearners import RLearner
from lightgbm import LGBMClassifier, LGBMRegressor
rlearner = RLearner(
nuisance_model_factory=LGBMRegressor,
propensity_model_factory=LGBMClassifier,
treatment_model_factory=LGBMRegressor,
is_classification=False,
n_variants=2,
)
features = ["age", "weight", "height"]
rlearner.fit(df[features], df["treatment"], df["outcomes"])
cate_estimates = rlearner.predict(df[features], is_oos=False)
Please refer to our docs for many more in-depth and reproducible examples.
Installation
metalearners
can either be installed via PyPI with
$ pip install metalearners
or via conda-forge with
$ conda install metalearners -c conda-forge
Development
Development instructions can be found here.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
metalearners-0.8.0.tar.gz
(934.2 kB
view hashes)
Built Distribution
Close
Hashes for metalearners-0.8.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8797d5eb0a0f6c6a787a0c4d5c48c75f0ea924dc60414e2ac0387f2ebcefeba |
|
MD5 | 64166e1ca2d5b27ea49af535c581f5c9 |
|
BLAKE2b-256 | e8bc0acb2461788f85ff561eac28d695b153952ddc1db8b7422acffcbe59902e |