{ "info": { "author": "Microsoft Corporation", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "[![Build Status](https://dev.azure.com/ms/EconML/_apis/build/status/Microsoft.EconML?branchName=master)](https://dev.azure.com/ms/EconML/_build/latest?definitionId=49&branchName=master)\n[![PyPI version](https://img.shields.io/pypi/v/econml.svg)](https://pypi.org/project/econml/)\n[![PyPI wheel](https://img.shields.io/pypi/wheel/econml.svg)](https://pypi.org/project/econml/)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/econml.svg)](https://pypi.org/project/econml/)\n\n\n\n

EconML: A Python Package for ML-Based Heterogeneous Treatment Effects Estimation

\n\n**EconML** is a Python package for estimating heterogeneous treatment effects from observational data via machine learning. This package was designed and built as part of the [ALICE project](https://www.microsoft.com/en-us/research/project/alice/) at Microsoft Research with the goal to combine state-of-the-art machine learning \ntechniques with econometrics to bring automation to complex causal inference problems. The promise of EconML:\n\n* Implement recent techniques in the literature at the intersection of econometrics and machine learning\n* Maintain flexibility in modeling the effect heterogeneity (via techniques such as random forests, boosting, lasso and neural nets), while preserving the causal interpretation of the learned model and often offering valid confidence intervals\n* Use a unified API\n* Build on standard Python packages for Machine Learning and Data Analysis\n\nIn a nutshell, this\ntoolkit is designed to measure the causal effect of some treatment variable(s) `T` on an outcome \nvariable `Y`, controlling for a set of features `X`. For detailed information about the package, \nconsult the documentation at https://econml.azurewebsites.net/.\n\n
\nTable of Contents\n\n- [Introduction](#introduction)\n - [About Treatment Effect Estimation](#about-treatment-effect-estimation)\n - [Example Applications](#example-applications)\n- [News](#news)\n- [Getting Started](#getting-started)\n - [Installation](#installation)\n - [Usage Examples](#usage-examples)\n- [For Developers](#for-developers)\n - [Running the tests](#running-the-tests)\n - [Generating the documentation](#generating-the-documentation)\n- [Blogs and Publications](#blogs-and-publications)\n- [Contributing and Feedback](#contributing-and-feedback)\n- [References](#references)\n\n
\n\n# Introduction\n\n## About Treatment Effect Estimation\n\nOne of the biggest promises of machine learning is to automate decision making in a multitude of domains. At the core of many data-driven personalized decision scenarios is the estimation of heterogeneous treatment effects: what is the causal effect of an intervention on an outcome of interest for a sample with a particular set of features? \n\nSuch questions arise frequently in customer segmentation (what is the effect of placing a customer in a tier over another tier), dynamic pricing (what is the effect of a pricing policy on demand) and medical studies (what is the effect of a treatment on a patient). In many such settings we have an abundance of observational data, where the treatment was chosen via some unknown policy, but the ability to run control A/B tests is limited.\n\n## Example Applications\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n

Customer Targeting

\n

Businesses offer personalized incentives to customers to increase sales and level of engagement. Any such personalized intervention corresponds to a monetary investment and the main question that business analytics are called to answer is: what is the return on investment? Analyzing the ROI is inherently a treatment effect question: what was the effect of any investment on a customer's spend? Understanding how ROI varies across customers can enable more targeted investment policies and increased ROI via better targeting. \n

\n
\n

Personalized Pricing

\n

Personalized discounts have are widespread in the digital economy. To set the optimal personalized discount policy a business needs to understand what is the effect of a drop in price on the demand of a customer for a product as a function of customer characteristics. The estimation of such personalized demand elasticities can also be phrased in the language of heterogeneous treatment effects, where the treatment is the price on the demand as a function of observable features of the customer.

\n
\n

Stratification in Clinical Trials

\n

\n Which patients should be selected for a clinical trial? If we want to demonstrate that a clinical treatment has an effect on at least some subset of a population then fully randomized clinical trials are inappropriate as they will solely estimate average effects. Using heterogeneous treatment effect techniques, we can use observational data to come up with estimates of these effects and identify good candidate patients for a clinical trial that our model estimates have high treatment effects.\n

\n
\n

Learning Click-Through-Rates

\n

\n In the design of a page layout and ad placement, it is important to understand the click-through-rate of page components on different positions of a page. Modern approaches may be to run multiple A/B tests, but when such page component involve revenue considerations, then observational data can help guide correct A/B tests to run. Heterogeneous treatment effect estimation can provide estimates of the click-through-rate of page components from observational data. In this setting, the treatment is simply whether the component is placed on that page position and the response is whether the user clicked on it.\n

\n
\n\n# News\n\n**04/10/2019:** Release v0.2, see release notes [here](https://github.com/Microsoft/EconML/releases/tag/v0.2).\n\n**03/06/2019:** Release v0.1, welcome to have a try and provide feedback.\n\n# Getting Started\n\n## Installation\n\nInstall the latest release from [PyPI](https://pypi.org/project/econml/):\n```\npip install econml\n```\nTo install from source, see [For Developers](#for-developers) section below.\n\n## Usage Examples\n\n* [Double Machine Learning](#references)\n\n ```Python\n from econml.dml import DMLCateEstimator\n from sklearn.linear_model import LassoCV\n\n est = DMLCateEstimator(model_y=LassoCV(), model_t=LassoCV)\n est.fit(Y, T, X, W) # W -> high-dimensional confounders, X -> features\n treatment_effects = est.const_marginal_effect(X_test)\n ```\n\n* [Orthogonal Random Forests](#references)\n\n ```Python\n from econml.ortho_forest import ContinuousTreatmentOrthoForest\n # Use defaults\n est = ContinuousTreatmentOrthoForest()\n # Or specify hyperparameters\n est = ContinuousTreatmentOrthoForest(n_trees=500, min_leaf_size=10, max_depth=10, \n subsample_ratio=0.7, lambda_reg=0.01,\n model_T=LassoCV(cv=3), model_Y=LassoCV(cv=3)\n )\n est.fit(Y, T, X, W)\n treatment_effects = est.const_marginal_effect(X_test)\n ```\n\n* [Deep Instrumental Variables](#references)\n\n ```Python\n import keras\n from econml.deepiv import DeepIVEstimator\n\n treatment_model = keras.Sequential([keras.layers.Dense(128, activation='relu', input_shape=(2,)),\n keras.layers.Dropout(0.17),\n keras.layers.Dense(64, activation='relu'),\n keras.layers.Dropout(0.17),\n keras.layers.Dense(32, activation='relu'),\n keras.layers.Dropout(0.17)])\n response_model = keras.Sequential([keras.layers.Dense(128, activation='relu', input_shape=(2,)),\n keras.layers.Dropout(0.17),\n keras.layers.Dense(64, activation='relu'),\n keras.layers.Dropout(0.17),\n keras.layers.Dense(32, activation='relu'),\n keras.layers.Dropout(0.17),\n keras.layers.Dense(1)])\n est = DeepIVEstimator(n_components=10, # Number of gaussians in the mixture density networks)\n m=lambda z, x: treatment_model(keras.layers.concatenate([z, x])), # Treatment model\n h=lambda t, x: response_model(keras.layers.concatenate([t, x])), # Response model\n n_samples=1 # Number of samples used to estimate the response\n )\n est.fit(Y, T, X, Z) # Z -> instrumental variables\n treatment_effects = est.effect(T0, T1, X_test)\n ```\n\n\n* Bootstrap Confidence Intervals\n ```Python\n from econml.bootstrap import BootstrapEstimator\n\n # Bootstrap estimator wrapper\n boot_est = BootstrapEstimator(est, n_bootstrap_samples=10)\n boot_est.fit(Y, T, X, W)\n treatment_effect_interval = boot_est.const_marginal_effect_interval(X_test, lower=1, upper=99)\n ```\n\nTo see more complex examples, go to the [notebooks](https://github.com/Microsoft/EconML/tree/master/notebooks) section of the repository. For a more detailed description of the treatment effect estimation algorithms, see the EconML [documentation](https://econml.azurewebsites.net/).\n\n# For Developers\n\nYou can get started by cloning this repository. We use \n[setuptools](https://setuptools.readthedocs.io/en/latest/index.html) for building and distributing our package.\nWe rely on some recent features of setuptools, so make sure to upgrade to a recent version with\n`pip install setuptools --upgrade`. Then from your local copy of the repository you can run `python setup.py develop` to get started.\n\n## Running the tests\n\nThis project uses [pytest](https://docs.pytest.org/) for testing. To run tests locally after installing the package, \nyou can use `python setup.py pytest`.\n\n## Generating the documentation\n\nThis project's documentation is generated via [Sphinx](https://www.sphinx-doc.org/en/master/index.html). To generate a local copy\nof the documentation from a clone of this repository, just run `python setup.py build_sphinx`, which will build the documentation and place it\nunder the `build/sphinx/html` path.\n\nThe reStructuredText files that make up the documentation are stored in the [docs directory](https://github.com/Microsoft/EconML/tree/master/doc); module documentation is automatically generated by the Sphinx build process.\n\n# Blogs and Publications\n\n* May 2019: [Open Data Science Conference Workshop](https://staging5.odsc.com/training/portfolio/machine-learning-estimation-of-heterogeneous-treatment-effect-the-microsoft-econml-library) \n\n* 2018: [Orthogonal Random Forests paper](https://arxiv.org/abs/1806.03467)\n\n* 2017: [DeepIV paper](http://proceedings.mlr.press/v70/hartford17a/hartford17a.pdf)\n\n# Contributing and Feedback\n\nThis project welcomes contributions and suggestions. Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit https://cla.microsoft.com.\n\nWhen you submit a pull request, a CLA-bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n# References\n\nM. Oprescu, V. Syrgkanis and Z. S. Wu.\n**Orthogonal Random Forest for Causal Inference.**\n[*ArXiv preprint arXiv:1806.03467*](http://arxiv.org/abs/1806.03467), 2018.\n\nJason Hartford, Greg Lewis, Kevin Leyton-Brown, and Matt Taddy. **Deep IV: A flexible approach for counterfactual prediction.** [*Proceedings of the 34th International Conference on Machine Learning*](http://proceedings.mlr.press/v70/hartford17a/hartford17a.pdf), 2017.\n\nV. Chernozhukov, D. Chetverikov, M. Demirer, E. Duflo, C. Hansen, and a. W. Newey. **Double Machine Learning for Treatment and Causal Parameters.** [*ArXiv preprint arXiv:1608.00060*](https://arxiv.org/abs/1608.00060), 2016.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Microsoft/EconML", "keywords": "treatment-effect", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "econml", "package_url": "https://pypi.org/project/econml/", "platform": "", "project_url": "https://pypi.org/project/econml/", "project_urls": { "Bug Tracker": "https://github.com/Microsoft/EconML/Issues", "Documentation": "https://econml.azurewebsites.net/", "Homepage": "https://github.com/Microsoft/EconML", "Source Code": "https://github.com/Microsoft/EconML" }, "release_url": "https://pypi.org/project/econml/0.4/", "requires_dist": [ "numpy", "scipy", "scikit-learn (>=0.20.0)", "keras", "sparse", "tensorflow (==1.*)", "joblib (>=0.13.0)", "numba (!=0.42.1)" ], "requires_python": "", "summary": "This package contains several methods for calculating Conditional Average Treatment Effects", "version": "0.4" }, "last_serial": 5355197, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "b8d0e76c2f01f2cd096ded94e3337b98", "sha256": "815a3dde1113f1399d60983386e6bf1a1198aa3fbb7cd292e9eeb9bf8590955c" }, "downloads": -1, "filename": "econml-0.1-py3.6.egg", "has_sig": false, "md5_digest": "b8d0e76c2f01f2cd096ded94e3337b98", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 263853, "upload_time": "2019-03-06T22:20:51", "url": "https://files.pythonhosted.org/packages/48/54/676bdbe8a86e48f3084e99de4c8df3fc6e756d49534a0633052d5eae9340/econml-0.1-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "0c3744e43c683065ad35129498cb0183", "sha256": "dcfe349281c6cffe9b750cfc828baae79cc2879f6ecb0b05bdf6aae94bb2e22c" }, "downloads": -1, "filename": "econml-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0c3744e43c683065ad35129498cb0183", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 178838, "upload_time": "2019-03-06T22:20:48", "url": "https://files.pythonhosted.org/packages/82/85/2580d173f9e33da3e31ee1be5ce9ec279a10cbda89daf40d55b242403324/econml-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3d4c537de0dc241ce0dd1f0c61dcc16e", "sha256": "151bd7ec238108c51801ea1a96e8c6fa388f5cc58b103b0c62e82909f14a46f4" }, "downloads": -1, "filename": "econml-0.1.tar.gz", "has_sig": false, "md5_digest": "3d4c537de0dc241ce0dd1f0c61dcc16e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 162116, "upload_time": "2019-03-06T22:20:52", "url": "https://files.pythonhosted.org/packages/3d/c5/fd3206d57200edf41ac7ad1bcabd4640e17880fd8349b17e24adeffedd85/econml-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "a3bfa9c3a3e24dddadb0e5d592520926", "sha256": "ffb31f5e95eb33d06a7bf00812a92558e83e2a696bc4f9704948340eebe0e11f" }, "downloads": -1, "filename": "econml-0.2-py3.6.egg", "has_sig": false, "md5_digest": "a3bfa9c3a3e24dddadb0e5d592520926", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 274890, "upload_time": "2019-04-11T01:17:23", "url": "https://files.pythonhosted.org/packages/09/64/26cbf68b14aadb093806b2e9491517053321ebe4ff26337150a206fc1856/econml-0.2-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "b59aa4a3184e720f15c2023e0b8f66b3", "sha256": "27e0556e1b119c53036092c67983c7ad4615e3635f275044a6785bc84a6594b1" }, "downloads": -1, "filename": "econml-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b59aa4a3184e720f15c2023e0b8f66b3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 185657, "upload_time": "2019-04-11T01:17:21", "url": "https://files.pythonhosted.org/packages/af/ec/6e2398e2acf503df654258ff3755137eaedcc71197fdd7289f6fba09a5e0/econml-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "343e582771270901a2defdc4fc79e11d", "sha256": "3fa6d41897a92356d320a58fd8bb2583b601b1f769b68a91ce2aca50e5b8b43f" }, "downloads": -1, "filename": "econml-0.2.tar.gz", "has_sig": false, "md5_digest": "343e582771270901a2defdc4fc79e11d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 169110, "upload_time": "2019-04-11T01:17:24", "url": "https://files.pythonhosted.org/packages/36/a4/1f04500ef33b5acd54124fd635208a466a385f7caa4ef8b4d3f62cc7c400/econml-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "30dae50e9aedf82388b06877ccb2cf95", "sha256": "f73ceec01269597a9349db3942912d0f2b166d9e5a697ae21219ffdac86a88d8" }, "downloads": -1, "filename": "econml-0.3-py3.6.egg", "has_sig": false, "md5_digest": "30dae50e9aedf82388b06877ccb2cf95", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 276841, "upload_time": "2019-05-03T15:16:17", "url": "https://files.pythonhosted.org/packages/0f/4e/b3a9673f854a8a1d5eedc30b00047c39242b0645e10871c67ccdb29a8033/econml-0.3-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "8882de5e593ab8f664a33f5dfbce293e", "sha256": "e802ed90645cc2cbdb74a1e7a383e36c6b6ffe7466d0da58123063cdf3ac3877" }, "downloads": -1, "filename": "econml-0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "8882de5e593ab8f664a33f5dfbce293e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 186570, "upload_time": "2019-05-03T15:16:16", "url": "https://files.pythonhosted.org/packages/32/5b/1b82a8452977aae137f45362c79e03bb623adaeb7bea038ad165fcef36b8/econml-0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9538fcd781dbdbd41d7292d58748644", "sha256": "11424e1367252b223289b2faa892b39d591d454b9be9ade59c480980f08e74a9" }, "downloads": -1, "filename": "econml-0.3.tar.gz", "has_sig": false, "md5_digest": "b9538fcd781dbdbd41d7292d58748644", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 169933, "upload_time": "2019-05-03T15:16:19", "url": "https://files.pythonhosted.org/packages/9b/ae/9dff6c96dd706c35d40291820843bbf01289c8d5a29486404188834e8f54/econml-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "f1995fcbd5f6e8ce915e2c042ecd4925", "sha256": "54d194adc28d2d71c92f5e1cb9ce0969fc0eedca8948b06f2eea944c6d7bfb4f" }, "downloads": -1, "filename": "econml-0.4-py3.6.egg", "has_sig": false, "md5_digest": "f1995fcbd5f6e8ce915e2c042ecd4925", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 278741, "upload_time": "2019-06-04T00:57:51", "url": "https://files.pythonhosted.org/packages/d9/ad/21a7b838dfbe8f2c97071ee75a175cda567d71d5c114d964c320dbde97e3/econml-0.4-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "f163a3c28cea423e4bb8e84e3ed4ca0e", "sha256": "0c832308406b4ff9f90939e63825a26aa02d99821d3679b024e49599a8d3c093" }, "downloads": -1, "filename": "econml-0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "f163a3c28cea423e4bb8e84e3ed4ca0e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 187484, "upload_time": "2019-06-04T00:57:50", "url": "https://files.pythonhosted.org/packages/91/9a/8ce586fbacdbd558fd4cecd014f7d9a86c98b99e2f0e03e60f5006470c04/econml-0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "079500e2086dcb8c893008578a39108a", "sha256": "488a4793018bb03dabfc2ead93f9a5971964a2530bc47bc8a3f34c8b65d092f2" }, "downloads": -1, "filename": "econml-0.4.tar.gz", "has_sig": false, "md5_digest": "079500e2086dcb8c893008578a39108a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 170799, "upload_time": "2019-06-04T00:57:53", "url": "https://files.pythonhosted.org/packages/ff/17/09700d64527d43c744aafd7dad36f9dfa758c9777c38a5bfbbd57feea5c4/econml-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f1995fcbd5f6e8ce915e2c042ecd4925", "sha256": "54d194adc28d2d71c92f5e1cb9ce0969fc0eedca8948b06f2eea944c6d7bfb4f" }, "downloads": -1, "filename": "econml-0.4-py3.6.egg", "has_sig": false, "md5_digest": "f1995fcbd5f6e8ce915e2c042ecd4925", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 278741, "upload_time": "2019-06-04T00:57:51", "url": "https://files.pythonhosted.org/packages/d9/ad/21a7b838dfbe8f2c97071ee75a175cda567d71d5c114d964c320dbde97e3/econml-0.4-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "f163a3c28cea423e4bb8e84e3ed4ca0e", "sha256": "0c832308406b4ff9f90939e63825a26aa02d99821d3679b024e49599a8d3c093" }, "downloads": -1, "filename": "econml-0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "f163a3c28cea423e4bb8e84e3ed4ca0e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 187484, "upload_time": "2019-06-04T00:57:50", "url": "https://files.pythonhosted.org/packages/91/9a/8ce586fbacdbd558fd4cecd014f7d9a86c98b99e2f0e03e60f5006470c04/econml-0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "079500e2086dcb8c893008578a39108a", "sha256": "488a4793018bb03dabfc2ead93f9a5971964a2530bc47bc8a3f34c8b65d092f2" }, "downloads": -1, "filename": "econml-0.4.tar.gz", "has_sig": false, "md5_digest": "079500e2086dcb8c893008578a39108a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 170799, "upload_time": "2019-06-04T00:57:53", "url": "https://files.pythonhosted.org/packages/ff/17/09700d64527d43c744aafd7dad36f9dfa758c9777c38a5bfbbd57feea5c4/econml-0.4.tar.gz" } ] }