Skip to main content

Causal Inference Library for Lift Measurement

Project description

🚀 RealLift

Causal Inference Library for Lift Measurement

RealLift is a powerful Python library designed to help data scientists and marketers measure the true impact of their interventions (treatments) using advanced causal inference techniques, such as GeoLift, Synthetic Control, and Placebo Testing.


✨ Features

  • 🎯 Geo-Splitting: Automatically find the best treatment and control groups based on historical correlation.
  • 📈 Synthetic Control: Build counterfactuals using a weighted combination of control regions.
  • 🧪 Significance Testing: Robust bootstrap-based confidence intervals and p-values.
  • 🛡️ Placebo Tests: Validate your model's reliability by running "fake" experiments on control groups.
  • ⏳ Duration Estimation: Calculate the necessary experiment duration based on MDE (Minimum Detectable Effect).
  • 📊 Professional Visualizations: Built-in plotting for experiment results and validation.

🚀 Installation

Install the stable version via PyPI:

pip install reallift

Or install the latest development version directly from GitHub:

pip install git+https://github.com/RobertoJuniorWXYZ/RealLift.git

⚡ Quick Start

1. Requirements & Design

Before starting an experiment, find the best clusters and estimate the required duration for a target MDE.

from reallift import run_geo_requirements

# Find best geo clusters and estimate duration
summary = run_geo_requirements(
    filepath="historical_data.csv",
    date_col="date",
    n_treatment=1,
    mde=0.015,
    max_days=60
)

2. Run a Complete Geo Experiment

Execute the full pipeline including validation, duration estimation, synthetic control, and placebo tests.

from reallift import run_geo_experiment

# Run full experiment pipeline
result = run_geo_experiment(
    filepath="your_data.csv",
    date_col="date",
    treatment_start_date="2025-05-01",
    n_treatment=1,
    mde=0.02
)

# Access results
print(f"Observed Lift: {result['results'][0]['synthetic']['lift_mean_abs']:.4f}")

📖 Examples

For a deep dive into the library's capabilities, check out our demonstration notebooks in the examples/geotests/ directory.


🛠️ Requirements

  • Python 3.8+
  • Pandas, Numpy, Scikit-Learn, Scipy, Matplotlib, CVXPY

📄 License

MIT License. See LICENSE for details.


Developed with ❤️ by Roberto Junior

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

reallift-0.1.1.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

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

reallift-0.1.1-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file reallift-0.1.1.tar.gz.

File metadata

  • Download URL: reallift-0.1.1.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for reallift-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ab4472dae3dafaea48a905716db32996f6ff2e5907831576ab15e4261a466b1f
MD5 3051dfc6d563684efa2ab020a376f9c6
BLAKE2b-256 3174ccf3e61436942f159e16131dfa6e6a6fd2ba8b429bafb5e98d83bf229a3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for reallift-0.1.1.tar.gz:

Publisher: publish.yml on RobertoJuniorWXYZ/RealLift

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

File details

Details for the file reallift-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: reallift-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for reallift-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 25b5f017c7879f035c966dce0d65e54bf889e82a4007ca1c56ccafd659456acb
MD5 fdfbf0f5463d872ed8801436d96e0cf5
BLAKE2b-256 989409630b38d2270a09874a885dd6e9220bd5076223bfff4af9e1f125b44b8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for reallift-0.1.1-py3-none-any.whl:

Publisher: publish.yml on RobertoJuniorWXYZ/RealLift

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