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
Release history Release notifications | RSS feed
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.11.0.tar.gz
(1.0 MB
view details)
Built Distribution
File details
Details for the file metalearners-0.11.0.tar.gz
.
File metadata
- Download URL: metalearners-0.11.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d4000bfe5e1240bb984aef304c3e6f09a0f206694770e624818fd330e811fa8 |
|
MD5 | 74bfa10cca553d5b0429c89f17e69a13 |
|
BLAKE2b-256 | cd44c533368d8dec9b0002858a8e09e8fe04110706988fb12e15749dc764bf5d |
File details
Details for the file metalearners-0.11.0-py3-none-any.whl
.
File metadata
- Download URL: metalearners-0.11.0-py3-none-any.whl
- Upload date:
- Size: 59.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3062022a48b82c435657e9108ca30f635939f9d69706dc4644b09cc8419ffe5 |
|
MD5 | b1b7cf6ea8e631b4a41f5119ea40ee09 |
|
BLAKE2b-256 | ecc4bbef5c50608f3cebff48cbf6d702554d10d38e0a73046ba2f41b086ccc47 |