Skip to main content

MetaLearners for CATE estimation

Project description

metalearners

CI Documentation Status Conda-forge PypiVersion codecov.io

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 soon onnx

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.11.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

metalearners-0.11.0-py3-none-any.whl (59.2 kB view details)

Uploaded Python 3

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

Hashes for metalearners-0.11.0.tar.gz
Algorithm Hash digest
SHA256 9d4000bfe5e1240bb984aef304c3e6f09a0f206694770e624818fd330e811fa8
MD5 74bfa10cca553d5b0429c89f17e69a13
BLAKE2b-256 cd44c533368d8dec9b0002858a8e09e8fe04110706988fb12e15749dc764bf5d

See more details on using hashes here.

File details

Details for the file metalearners-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for metalearners-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3062022a48b82c435657e9108ca30f635939f9d69706dc4644b09cc8419ffe5
MD5 b1b7cf6ea8e631b4a41f5119ea40ee09
BLAKE2b-256 ecc4bbef5c50608f3cebff48cbf6d702554d10d38e0a73046ba2f41b086ccc47

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page