Skip to content

TianyiPeng/nonstationary-DQ-ridesharing

Repository files navigation

Dynamic Ridesharing Experiment Analysis

This repository contains code for running and analyzing dynamic ridesharing experiments, including switchback and naive A/B testing designs.

Project Structure

  • analyze_ate.py: Analysis of Average Treatment Effects (ATE) with various estimators
  • rideshare.py: Main simulation code for ridesharing experiments
  • taxi-zones.parquet: Taxi zone data for Manhattan
  • manhattan-nodes.parquet: Node data for Manhattan street network
  • configs/: Configuration files for different experimental setups (YAML format)
  • output/: Directory for experiment results

Setup

  1. Install dependencies using Poetry:
poetry install
  1. 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
  1. Analyze results:
# For switchback design
poetry run python analyze_ate.py --n_events 500000 --design switchback --switch_interval 120

Analysis Features

  • True ATE calculation from pure A/B conditions
  • Naive IPW estimator
  • DQ(k) estimator with varying window sizes

Dependencies

See pyproject.toml for the complete list of dependencies. Main requirements:

  • JAX
  • Pandas
  • NumPy
  • Matplotlib
  • Sacred

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages