neuronslabs/comfyCausalAI
0
Causal AI - Synthetic Customer Data Generator and RCT Simulator
Project Overview
This project provides a comprehensive toolkit for generating synthetic e-commerce customer data, simulating Randomized Control Trials (RCTs), and analyzing the results using causal inference techniques. It's designed to help data scientists and analysts explore the impact of various discount strategies on customer behavior and business metrics.
Key Features
- Synthetic Data Generation: Create realistic customer profiles with various attributes.
- RCT Simulation: Run experiments with different discount levels.
- Results Analysis: Analyze the impact of discounts on key business metrics.
- Uplift Modeling: Build and evaluate uplift models to predict individual treatment effects.
- Targeted Policy Simulation: Test targeting strategies based on uplift model predictions.
Project Structure
app.py: Main application file with Gradio interfacedata_generator.py: Synthetic customer data generationrct_simulator.py: Randomized Control Trial simulationrct_analyzer.py: Analysis of RCT resultsrequirements.txt: List of required Python packages
Installation
- Clone the repository:
git clone https://github.com/neurons-lab/causal-ai.git
cd causal-ai- Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`- Install the required packages:
pip install -r requirements.txtUsage
Run the main application:
python app.pyThis will start the Gradio interface, which you can access through your web browser. The interface is divided into several tabs:
- Generate Customer Data: Create synthetic customer profiles.
- Run RCT Simulation: Simulate a Randomized Control Trial with different discount levels.
- Analyze RCT Results: View and analyze the results of the RCT.
- Exploratory Data Analysis: Explore the impact of discounts on different customer segments.
- Build Uplift Model: Create uplift models to predict individual treatment effects.
- Run Targeting Policy: Test targeting strategies based on uplift model predictions.
Customization
You can customize various aspects of the simulation:
- Modify the
electronics_productslist inrct_simulator.pyto change the available products. - Adjust the
calculate_purchase_probabilityfunction inrct_simulator.pyto alter how customer attributes affect purchase likelihood. - Update the
REGIONSdictionary indata_generator.pyto change the demographic characteristics of different regions.
