Skip to main content

A User Parameter-free Bayesian Framework for Uplift Modeling

Project description

kuplift package

kuplift is a Python package that provides a series of uplift modeling methods based on recent research work. kuplift allows users to easily use the following algorithms:

  1. Encoding data using a discretization method for treatment effect (uplift) modeling called UMODL.

  2. OptimizedUnivariateEncoding is an optimized version of the umodl algorithm written in C++ for continuous and categorical variables.

  3. Variable selection for uplift modeling with UMODL-FS.

  4. Learning a Bayesian decision tree model for uplift modeling with UB-DT.

  5. Learning a random forest model for uplift modeling with UB-RF.

How to install

$ pip install kuplift

User Guide

import kuplift as kp
import pandas as pd

df = pd.read_csv("data.csv")

# Make sure the dtype of all categorical variables is object
df = df.astype({"some_categorical_variable": object})

variables = list(df.columns[:-2])  # Last two columns are treatment and target columns

# Univariate variable transformation
ue = kp.UnivariateEncoding()
encoded_data = ue.fit_transform(df[variables], df["treatment"], df["target"])

# Univariate variable transformation optimized through the use of the C++ implementation of umodl
ue = kp.OptimizedUnivariateEncoding()
encoded_data = ue.fit_transform(df[variables], df["treatment"], df["target"])

# Feature selection
fs = kp.FeatureSelection()
important_vars = fs.filter(df[variables], df["treatment"], df["target"])

# Uplift Bayesian Decision Tree
tree = kp.BayesianDecisionTree()
tree.fit(df[variables], df["treatment"], df["target"])
preds = tree.predict(df[variables])

# Uplift Bayesian Random Forest
forest = kp.BayesianRandomForest(n_trees=4)
forest.fit(df[variables], df["treatment"], df["target"])
preds = forest.predict(df[variables])

Examples

You can find examples in the examples directory.

Documentation

Refer to the documentation at https://udata-orange.github.io/kuplift/

Credits

kuplift has been developed at Orange Labs.

Current contributors

Mina Rafla

Nicolas Voisine

References

Rafla, M., Voisine, N., Crémilleux, B., & Boullé, M. (2022, September). A non-parametric bayesian approach for uplift discretization and feature selection. ECML PKDD 2022

Rafla, M., Voisine, N., & Crémilleux, B. (2023, May). Parameter-free Bayesian decision trees for uplift modeling. PAKDD 2023

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

kuplift-0.0.17a2.tar.gz (110.8 kB view details)

Uploaded Source

Built Distribution

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

kuplift-0.0.17a2-py3-none-any.whl (77.3 kB view details)

Uploaded Python 3

File details

Details for the file kuplift-0.0.17a2.tar.gz.

File metadata

  • Download URL: kuplift-0.0.17a2.tar.gz
  • Upload date:
  • Size: 110.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kuplift-0.0.17a2.tar.gz
Algorithm Hash digest
SHA256 088e2e2adca81dc1b59326f2f72f3236729ed1379057f8bea6baf7b797b7de28
MD5 a8d0c891c03a52583f1af6adaf1deb12
BLAKE2b-256 72172072f39233b9245b6b110483ea79b13c72ba6e72ffdeecb1435d064c04d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for kuplift-0.0.17a2.tar.gz:

Publisher: release-workflow.yml on UData-Orange/kuplift

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

File details

Details for the file kuplift-0.0.17a2-py3-none-any.whl.

File metadata

  • Download URL: kuplift-0.0.17a2-py3-none-any.whl
  • Upload date:
  • Size: 77.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kuplift-0.0.17a2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a56a61e3b77bdb2d3149194b9cbac12aad2afb1999ff77dda1b3cc5aff29382
MD5 57c288d09ee34e1fc8f8dd0e83c19d10
BLAKE2b-256 72618fb7695dc22e0827ac8c38e6fa228e42acbccdd69ebfcfdef04a9ba98ce6

See more details on using hashes here.

Provenance

The following attestation bundles were made for kuplift-0.0.17a2-py3-none-any.whl:

Publisher: release-workflow.yml on UData-Orange/kuplift

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