Skip to main content

Causal Inference Library for Lift Measurement

Project description

RealLift

RealLift Logo

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


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.3.tar.gz (4.0 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.3-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: reallift-0.1.3.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

Hashes for reallift-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a55b051505c910b59e665fb2b84b422002e1acd8f0848bd6c5a3f39158648f81
MD5 8a35c526b533e2d7dffdca84b41855af
BLAKE2b-256 ebb24aa79a76c436c7a70d1c87eb9fa0a0d63f5dae6dfcb1c48fc4f7ab4ec272

See more details on using hashes here.

Provenance

The following attestation bundles were made for reallift-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: reallift-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 27.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1135a09d96257dd0d77a611476b5f104c34054a3fdd59f87b88942c6b83e2bf8
MD5 1b76e6d5617ddcc4e5f5185773690275
BLAKE2b-256 dea20e3b744569af49f586b0f22f8722bb264f8be988cf15b431cf4e6d59ff91

See more details on using hashes here.

Provenance

The following attestation bundles were made for reallift-0.1.3-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