Causal Inference Library for Lift Measurement
Project description
RealLift
Causal Inference Framework for Geo Experiments & Marketing Science
RealLift is an advanced Python library engineered to measure the true incremental impact (Lift) of marketing interventions through rigorous Causal Inference, Synthetic Control methodologies, and Robust Significance Testing.
Framework Pillars
RealLift is built upon four layers of defense against noise and volatility:
- Data Quality (Clean): Intelligent missing value imputation and filtering of noisy geographic entities to ensure high-fidelity inputs.
- Auditable Planning (Design of Experiments): Algorithmically identifies the optimal geographic clusters and projects statistical power (MDE) prior to any campaign investment.
- Causal Inference (Synthetic Control): Formulates robust counterfactuals via Convex Optimization with Intercept, ensuring behavioral alignment even across differing baseline levels.
- Confidence Validation (Placebo & Significance): Defends analytical conclusions through Moving Block Bootstrap (MBB) and Permutation tests, providing indisputable visual and statistical evidence.
Installation
pip install reallift
Quick Start Guide
The RealLift 2.0 API is object-oriented. You instantiate a single RealLift orchestrator that holds the state of your data in-memory, making execution blazingly fast and extremely simple.
1. Initialize and Clean Data
Load your Pandas DataFrame and initialize the RealLift orchestrator.
import pandas as pd
from reallift import RealLift
# Load your raw data
df = pd.read_csv("geo_daily_sales.csv")
# Initialize orchestrator
rl = RealLift(df, date_col="date")
# Clean, filter, and impute missing data (returns a clean DataFrame and a visual report)
df_clean = rl.clean(
geos=None, # auto-detects
imputation_method="interpolation"
)
2. Design the Experiment (Pre-Test Phase)
Use the DoE pipeline to rigorously select the best treatment and control geometries based on historical correlations.
# Run the Design of Experiments
doe_results = rl.design_of_experiments(
start_date="2025-01-01",
end_date="2025-03-31",
experiment_days=[21, 28, 30],
n_folds=5
)
# Export an executive PDF report
doe_results.export_report("experiment_design.pdf")
3. Evaluate Incremental Impact (Post-Test Phase)
Measure the precise financial and percentual lift utilizing the Causal Inference engine against the final dataset after the campaign.
# Assuming 'df_post' now contains the full historical + campaign data
rl = RealLift(df_post, date_col="date")
# Run the causal inference analysis
exp_results = rl.run(
treatment_start_date="2025-04-01",
treatment_end_date="2025-04-21",
start_date="2025-01-01",
doe=doe_results,
scenario=0
)
4. Professional Visual Diagnostics
RealLift ships with a "Black Premium" plotting suite designed for executive presentations.
# View Treatment vs Synthetic for each cluster (Test period only)
exp_results.plot_cluster_effects(post_only=True)
# View aggregated causal impact across all regions
exp_results.plot_consolidated_effect(post_only=True)
# View the Hypothesis Test (H0 vs H1) using Bootstrap distributions
exp_results.plot_lift_distributions(show_null=True)
Technical Differentiators
- Object-Oriented & In-Memory: Zero disk I/O bottlenecks. Manipulate and pass Pandas DataFrames directly into the engine.
- Convex Intercept: Intelligent baseline shift absorption that preserves the interpretability of synthetic weights ($\sum w = 1$).
- Moving Block Bootstrap (MBB): Retains temporal autocorrelation during significance testing to prevent artificially tight confidence intervals.
- Executive Aesthetics: Built-in
matplotlibdark themes tailored for C-Level data storytelling and unquestionable visual significance.
Systems & Dependencies
- Mathematics:
cvxpy,scipy,numpy - Data Engineering:
pandas,scikit-learn - Visualization:
matplotlib
Developed by Roberto Junior.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reallift-0.6.0.tar.gz.
File metadata
- Download URL: reallift-0.6.0.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1520815718460b98e33fbf680933a48f6e48006df8ed1bc7578a74e29ec06b2
|
|
| MD5 |
c4cbb6abf2eec68ae62f1f5947d4c5b7
|
|
| BLAKE2b-256 |
886829da69bb5f4a89bc64f92ab5ec1bf69532af3ee464de7737815e15ea3556
|
Provenance
The following attestation bundles were made for reallift-0.6.0.tar.gz:
Publisher:
publish.yml on RobertoJuniorWXYZ/RealLift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reallift-0.6.0.tar.gz -
Subject digest:
a1520815718460b98e33fbf680933a48f6e48006df8ed1bc7578a74e29ec06b2 - Sigstore transparency entry: 1574079876
- Sigstore integration time:
-
Permalink:
RobertoJuniorWXYZ/RealLift@d3a7a483a3cbbe8cf047827b2ff654f0dd645271 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/RobertoJuniorWXYZ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d3a7a483a3cbbe8cf047827b2ff654f0dd645271 -
Trigger Event:
push
-
Statement type:
File details
Details for the file reallift-0.6.0-py3-none-any.whl.
File metadata
- Download URL: reallift-0.6.0-py3-none-any.whl
- Upload date:
- Size: 87.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
967d5353a1bcb3b03e6737f374c2cfb49f9a5197d6fa10d8d7507ab0201ec928
|
|
| MD5 |
41512866f18697b7a141671819cfd825
|
|
| BLAKE2b-256 |
f31c26e19a4ff176f02e9a41f712632cb9a3807b30dc9dd6b7cc254e239d36df
|
Provenance
The following attestation bundles were made for reallift-0.6.0-py3-none-any.whl:
Publisher:
publish.yml on RobertoJuniorWXYZ/RealLift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reallift-0.6.0-py3-none-any.whl -
Subject digest:
967d5353a1bcb3b03e6737f374c2cfb49f9a5197d6fa10d8d7507ab0201ec928 - Sigstore transparency entry: 1574079899
- Sigstore integration time:
-
Permalink:
RobertoJuniorWXYZ/RealLift@d3a7a483a3cbbe8cf047827b2ff654f0dd645271 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/RobertoJuniorWXYZ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d3a7a483a3cbbe8cf047827b2ff654f0dd645271 -
Trigger Event:
push
-
Statement type: