ibotta_uplift: Machine learning uplift model package
Introduction
There are currently several packages for uplift models (see EconML and GRF). They tend to focus on interesting ways of estimating the heterogeneous treatment effect. However models in their current state tend to focus on the single response, singe treatment scenario. In addition the metrics they use do not give estimates to the expectations of response variables if the models were used in practice.
This package attempts to build an automated solution for Uplift modeling that includes the following features:
It allows for Multiple Treatments. In addition one can incorporate meta features for each treatment. For example; a particular treatment might have several shared features with other bonuses. Instead of creating a dummy indicator for each bonus the user can create a vector of categorial or continuous variables to represent the treatment.
ERUPT functionality that estimates model performance on OOS data. This metric calculates the expected response if the model were given to the average user.
Support for multiple responses. This allows estimation of tradeoffs between maximizing / minimizing weighted sums of responses. An example can be found here
It does so by estimating a neural network of the form y ∼ f(t,x) where y, x, and t are the response, explanatory variables and treatment variables. It is assumed the treatment was randomly assigned. There is functionality to predict counterfactuals for all treatments and calculates ERUPT metrics on out of sample data.
Quick Start Example
In a python enviornment :
import numpy as np
import pandas as pd
from dataset.data_simulation import get_simple_uplift_data
from ibotta_uplift.ibotta_uplift import IbottaUplift
#Generate Data
y, x, t = get_simple_uplift_data(10000)
y = pd.DataFrame(y)
y.columns = ['revenue','cost', 'noise']
y['profit'] = y['revenue'] - y['cost']
#Build / Gridsearch model
uplift_model = IbottaUplift()
param_grid = dict(num_nodes=[8], dropout=[.1, .5], activation=[
'relu'], num_layers=[1, 2], epochs=[25], batch_size=[30])
uplift_model.fit(x, y[['profit']], t.reshape(-1,1), param_grid = param_grid, n_jobs = 1)
#OOS ERUPT Curves
erupt_curves, dists = uplift_model.get_erupt_curves()
#predict optimal treatments with new observations
_, x_new ,_ = get_simple_uplift_data(5)
uplift_model.predict_optimal_treatments(x_new, weights = np.array([.6,-.4,0,0]).reshape(1,-1))
Relevant Papers and Blog Posts
For Discussion on the metric used to calculate how model performs see:
ERUPT: Expected Response Under Proposed Treatments
Uplift Modeling with Multiple Treatments and General Response Types
Heterogeneous Treatment Effects and Optimal Targeting Policy Evaluation
For tradeoff analysis see:
Estimating and Visualizing Business Tradeoffs in Uplift Models
Metadata
Release files for ibotta-uplift 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ibotta_uplift-0.0.4.tar.gz | 12.2 kB | Without provenance | Details for ibotta_uplift-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ibotta_uplift-0.0.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for ibotta_uplift-0.0.4-py2.py3-none-any.whl |
Total release size: 30.8 kB
Release files / ibotta_uplift-0.0.4.tar.gz
| Download URL | ibotta_uplift-0.0.4.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7374b706ba4a6190c561e4f1cf0887eee7e96e71d52c66bfa3a5d4ddffd85013
|
|
BLAKE2b-256 checksum How to use checksums |
35725098b3e240c9b4c8cbafa85183eeab5d2f9358c49da39a7b01eb64e0f283
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.14
|
Release files / ibotta_uplift-0.0.4-py2.py3-none-any.whl
| Download URL | ibotta_uplift-0.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
64661545e445fcb8a1e3ad0e907c05bd6e9e5a89b038b95c9da4a019441b26f3
|
|
BLAKE2b-256 checksum How to use checksums |
8e5e99971303ad1628b3897e3c54d4f4b8210c9933431be3b4840679bf081c46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.14
|
Security for ibotta-uplift 0.0.4
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.