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["outcomes"], df["treatment"])
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.13.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metalearners-0.13.0-py3-none-any.whl (62.0 kB view details)

Uploaded Python 3

File details

Details for the file metalearners-0.13.0.tar.gz.

File metadata

  • Download URL: metalearners-0.13.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for metalearners-0.13.0.tar.gz
Algorithm Hash digest
SHA256 88477130c8828c607042fed07dde710d8066664f74f7f8f20c075b021ac97c58
MD5 2fd7cb17b2744858655b80f4528fa70e
BLAKE2b-256 e079a194a57e56cbd4d5e3eb542b6b315524326e43563a4550cb16012f4ab12d

See more details on using hashes here.

Provenance

The following attestation bundles were made for metalearners-0.13.0.tar.gz:

Publisher: package.yml on Quantco/metalearners

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: metalearners-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 62.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for metalearners-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a260cecd9da2529ac5eaadeb5fda037c79815afc03e84c92f409f7a11488fccd
MD5 31802bd1fba900814c899a4ec1b7792b
BLAKE2b-256 d7b7c6de1c2ef9c17d7824e78b639439f5957506b094e2b19edce9cc1d9d0bb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for metalearners-0.13.0-py3-none-any.whl:

Publisher: package.yml on Quantco/metalearners

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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