Skip to main content

PyPI Downloads PyPI Downloads

mcf – Modified Causal Forest in Python

mcf is a Python package implementing the Modified Causal Forest (MCF) methodology introduced by Lechner (2018) for estimating heterogeneous causal effects.

It provides a flexible framework for causal machine learning with support for binary and multiple treatments in both experimental and observational data settings.

In addition to treatment effect estimation, mcf enables data-driven policy learning through optimal treatment allocation rules based on estimated potential outcomes.


Documentation and Maintenance


Main Features

The mcf package provides two core components for causal machine learning:

Modified Causal Forest

The ModifiedCausalForest class implements a flexible tree-based framework for estimating heterogeneous treatment effects. It supports:

  • Estimation of and inference for individualized treatment effects (IATEs) and aggregates as the (group) average treatment effects (GATEs, ATEs)
  • Binary and multiple treatment settings
  • Experimental and observational data
  • Flexible covariate specification (ordered and unordered variables)

The object-oriented design provides a unified workflow for model training, prediction, and extraction of causal estimates.


Optimal Policy Learning

The OptimalPolicy class enables data-driven treatment assignment by learning decision rules that maximize a reward function. It provides:

  • Learning of optimal treatment allocation rules
  • Policy evaluation on training and test data
  • Support for multiple treatment alternatives and policy constraints

This allows translation of policy scores into actionable decision rules for optimal policy design.


Citation

The implementation builds on the following literature:

  • Lechner (2019): Modified Causal Forests for Estimating Heterogeneous Causal Effects. arXiv:1812.09487.
@misc{lechner2019modifiedcausalforest,
  title        = {Modified Causal Forests for Estimating Heterogeneous Causal Effects},
  author       = {Michael Lechner},
  year         = {2019},
  eprint       = {1812.09487},
  archivePrefix = {arXiv},
  primaryClass = {econ.EM},
  url          = {https://arxiv.org/abs/1812.09487}
}

License

This project is distributed under the MIT License.

Metadata

Release files for mcf 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcf 0.11.0
File Size Uploaded Provenance
mcf-0.11.0.tar.gz 553.9 kB Without provenance Details

Release files / mcf-0.11.0.tar.gz

Download URL mcf-0.11.0.tar.gz
Size 553.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1d9f423eeba7a013353c30878d901268c7c3e80100ec38043ecc1d1e4eef0f73
BLAKE2b-256 checksum
How to use checksums
e63987ce7375fac62721eb35a8568837cea784b38ebf523b363a26da1310ff0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for mcf 0.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.11.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page