Skip to main content

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


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.2.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.2-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

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

Hashes for reallift-0.1.2.tar.gz
Algorithm Hash digest
SHA256 169c0cfffcf95b9678944c751c91a22a06a13ac3bc5aba2e7a06072a217ac7e4
MD5 4f6a6e74ecf8a27588ddf75fc0a7ad81
BLAKE2b-256 caf90f22ea5f4716ff7a7c8fb4319d10c6d660aa4c0dc202387c77ed04388c7d

See more details on using hashes here.

Provenance

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

Hashes for reallift-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 151e827a9ddf529f368902fb8650f00c7f65eeeb72d638275c0134dab9d4c024
MD5 981e0e898edcdc45a8d0e3b0b8e70acd
BLAKE2b-256 0315e94a8003334f6a5027a66455ec69251e885f187eaab0c2224dca1169946c

See more details on using hashes here.

Provenance

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