This repository contains code for running and analyzing dynamic ridesharing experiments, including switchback and naive A/B testing designs.
analyze_ate.py
: Analysis of Average Treatment Effects (ATE) with various estimatorsrideshare.py
: Main simulation code for ridesharing experimentstaxi-zones.parquet
: Taxi zone data for Manhattanmanhattan-nodes.parquet
: Node data for Manhattan street networkconfigs/
: Configuration files for different experimental setups (YAML format)output/
: Directory for experiment results
- Install dependencies using Poetry:
poetry install
- Run experiments using configuration files:
# For naive A/B testing
poetry run python rideshare.py with config_file=configs/naive-AB.yaml
# For switchback design
poetry run python rideshare.py with config_file=configs/switchback.yaml
Example configuration file (configs/switchback.yaml):
n_cars: 300
k: 100
batch_size: 100
p: 0.5
seed: 42
n_events: 500000
design:
name: switchback
switch_every: 120
output: output/switchback/results
config_output: output/switchback/config
- Analyze results:
# For switchback design
poetry run python analyze_ate.py --n_events 500000 --design switchback --switch_interval 120
- True ATE calculation from pure A/B conditions
- Naive IPW estimator
- DQ(k) estimator with varying window sizes
See pyproject.toml
for the complete list of dependencies. Main requirements:
- JAX
- Pandas
- NumPy
- Matplotlib
- Sacred