Causal Inference Library for Lift Measurement
Project description
RealLift
Causal Inference Library for Lift Measurement & Design of Experiments
RealLift is an advanced Python library engineered to assist data scientists and analysts in reliably measuring the true incremental impact of interventions through rigorous causal inference methodologies, such as GeoLift, Synthetic Control Estimation, and Placebo Testing.
Capabilities
- Design of Experiments (Geo-Splitting): Algorithmically identifies structural clusters and mathematically selects the optimal treatment and control regions based on ElasticNet feature selection and convex proximity matrices.
- Synthetic Control Measurement: Formulates robust counterfactual interventions by mapping temporal correlations across a predefined array of donor regions via constrained Convex Optimization (
cvxpy). - Time Series Cross-Validation: Ensures predictive validity of counterfactuals via Historical Simulation, isolating definitive Out-Of-Fold (OOF) $R^2$ and MAPE limits prior to experiments.
- Duration & Statistical Power: Estimates predictive power dynamically over time streams to establish strict Minimum Detectable Effect (MDE) bounds before test implementation.
- Significance & Placebo Testing: Empirically defends the analytical conclusions through non-parametric bootstrap sampling and randomized spatial placebo permutations to comprehensively evaluate the null hypothesis.
Installation
RealLift is securely distributed through PyPI for production environments:
pip install reallift
Alternatively, obtain the latest development snapshot directly from the source repository:
pip install git+https://github.com/RobertoJuniorWXYZ/RealLift.git
Quick Start Guide
1. Requirements & Design (Pre-Test Phase)
Before executing a field intervention, analyze the underlying baseline correlation to discover optimal clusters and project the duration strictly necessary to capture a target Minimum Detectable Effect (MDE).
from reallift import run_geo_requirements
# Identify structural blocks and validate exposure durations
summary = run_geo_requirements(
filepath="historical_data.csv",
date_col="date",
n_treatment=1,
mde=0.015,
max_days=[21, 60],
n_folds=5,
verbose=True
)
2. Intervention Measurement (Post-Test Phase)
Following the completion of an intervention, apply the algorithmic pipeline encompassing validation constraint-checking, Synthetic Control extraction, and empirical Placebo diagnostics.
from reallift import run_geo_experiment
# Execute the complete analytical pipeline
result = run_geo_experiment(
filepath="experiment_data.csv",
date_col="date",
treatment_start_date="2025-05-01",
n_treatment=1,
mde=0.015,
max_days=[21, 60],
n_folds=5,
random_state=42,
verbose=True
)
# Extract total absolute impact estimates
print(f"Incremental Lift (abs): {result['results'][0]['synthetic']['lift_total']:.2f}")
Examples & Application
For a comprehensive methodological demonstration concerning correlation assumptions, feature engineering operations, and diagnostic evaluation limits, refer to the Jupyter notebooks mapped under the examples/geotests/ directory within the primary repository.
Systems & Dependencies
- Platform Target: Python 3.8+
- Mathematics:
cvxpy(Core algorithmic solver for constraints) - Data Engineering:
pandas,numpy,scikit-learn,scipy - Plotting Engines:
matplotlib,seaborn
License
MIT License. Navigate to the LICENSE file for full disclosure.
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.1.2.tar.gz.
File metadata
- Download URL: reallift-0.1.2.tar.gz
- Upload date:
- Size: 4.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
169c0cfffcf95b9678944c751c91a22a06a13ac3bc5aba2e7a06072a217ac7e4
|
|
| MD5 |
4f6a6e74ecf8a27588ddf75fc0a7ad81
|
|
| BLAKE2b-256 |
caf90f22ea5f4716ff7a7c8fb4319d10c6d660aa4c0dc202387c77ed04388c7d
|
Provenance
The following attestation bundles were made for reallift-0.1.2.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.1.2.tar.gz -
Subject digest:
169c0cfffcf95b9678944c751c91a22a06a13ac3bc5aba2e7a06072a217ac7e4 - Sigstore transparency entry: 1195340433
- Sigstore integration time:
-
Permalink:
RobertoJuniorWXYZ/RealLift@5a125cad6f18eede2fb1871c5375c2607adf2926 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/RobertoJuniorWXYZ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5a125cad6f18eede2fb1871c5375c2607adf2926 -
Trigger Event:
push
-
Statement type:
File details
Details for the file reallift-0.1.2-py3-none-any.whl.
File metadata
- Download URL: reallift-0.1.2-py3-none-any.whl
- Upload date:
- Size: 27.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
151e827a9ddf529f368902fb8650f00c7f65eeeb72d638275c0134dab9d4c024
|
|
| MD5 |
981e0e898edcdc45a8d0e3b0b8e70acd
|
|
| BLAKE2b-256 |
0315e94a8003334f6a5027a66455ec69251e885f187eaab0c2224dca1169946c
|
Provenance
The following attestation bundles were made for reallift-0.1.2-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.1.2-py3-none-any.whl -
Subject digest:
151e827a9ddf529f368902fb8650f00c7f65eeeb72d638275c0134dab9d4c024 - Sigstore transparency entry: 1195340526
- Sigstore integration time:
-
Permalink:
RobertoJuniorWXYZ/RealLift@5a125cad6f18eede2fb1871c5375c2607adf2926 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/RobertoJuniorWXYZ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5a125cad6f18eede2fb1871c5375c2607adf2926 -
Trigger Event:
push
-
Statement type: