Skip to main content

WhyShift: A Benchmark with Specified Distribution Shift Patterns

Jiashuo Liu*, Tianyu Wang*, Peng Cui, Hongseok Namkoong

Tsinghua University, Columbia University

WhyShift is a python package that provides a benchmark with various specified distribution shift patterns on real-world tabular data. And several tools to diagnose performance degradation are integrated in it. Our testbed highlights the importance of future research that builds an understanding of how distributions differ. For more details, please refer to our paper.

If you find this repository useful in your research, please cite the following paper:

@inproceedings{liu2023need,
  title={On the Need for a Language Describing Distribution Shifts: Illustrations on Tabular Datasets},
  author={Jiashuo Liu and Tianyu Wang and Peng Cui and Hongseok Namkoong},
  booktitle={Thirty-seventh Conference on Neural Information Processing Systems Datasets and Benchmarks Track},
  year={2023}
}

This paper as follows is an extended version of the previous conference paper, including more algorithms and distribution shifts on tabular data:

@article{wang2026rethinking,
  title={Rethinking Distribution Shifts: Empirical Analysis and Modeling for Tabular Data},
  author={Wang, Tianyu and Liu, Jiashuo and Cui, Peng and Namkoong, Hongseok},
  journal={Management Science (forthcoming)},
  year={2026}
}

For settings utilizing ACS Income, Public Coverage, Mobility datasets

  • get_data(task, state, year, need_preprocess, root_dir) function
    • task values: 'income', 'pubcov', 'mobility'
  • examples:
    from whyshift import get_data
    # for ACS Income
    X, y, feature_names = get_data("income", "CA", True, './datasets/acs/', 2018)
    # for ACS Public Coverage
    X, y, feature_names = get_data("pubcov", "CA", True, './datasets/acs/', 2018)
    # for ACS Mobility
    X, y, feature_names = get_data("mobility", "CA", True, './datasets/acs/', 2018)
    
  • support state values:
    • ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY', 'PR']

For settings utilizing US Accident, Taxi datasets

  • download data files:
    # US Accident:
    https://www.kaggle.com/datasets/sobhanmoosavi/us-accidents
    # Taxi
    https://www.kaggle.com/competitions/nyc-taxi-trip-duration
    
  • put data files in dir ./datasets/
    • accident: ./datasets/Accident/US_Accidents_Dec21_updated.csv
    • taxi: ./datasets/Taxi/{city}_clean.csv
  • pass the path to the data file of get_data function
  • example:
    from whyshift import get_data
    # for US Accident
    X, y, _ = get_data("accident", "CA", True, './datasets/Accident/US_Accidents_Dec21_updated.csv')
    # for Taxi
    X, y, _ = get_data("taxi", "nyc", True, './datasets/Taxi/train.csv')
    
  • support state values:
    • for US Accident: ['CA', 'TX', 'FL', 'OR', 'MN', 'VA', 'SC', 'NY', 'PA', 'NC', 'TN', 'MI', 'MO']
    • for Taxi: ['nyc', 'bog', 'uio', 'mex']

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whyshift-0.1.4.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whyshift-0.1.4-py3-none-any.whl (41.6 kB view details)

Uploaded Python 3

File details

Details for the file whyshift-0.1.4.tar.gz.

File metadata

  • Download URL: whyshift-0.1.4.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for whyshift-0.1.4.tar.gz
Algorithm Hash digest
SHA256 718e4245c8b2d792b71ac7db6942cfdd3fef8d7bbcd733b2287149e81c09fb61
MD5 05521f14a0934b49c8e49c0fcdfed81c
BLAKE2b-256 9ec09db0f6ebdf47e592f0b886dcc4bf01cad8bb5a343409f8adfce02de5340b

See more details on using hashes here.

File details

Details for the file whyshift-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: whyshift-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 41.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for whyshift-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2e4999bc36a2cda6b9de7989abf2977a3974790e6c99eaa420de9b75a2eb76f9
MD5 8d65d0f482c51e58194f477570df68aa
BLAKE2b-256 80bbca0380056701d2398b3fa57af82b116359b64079c71adf45c854e113ea83

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 files

0.1.3

2 files

0.1.2

2 files

0.1.0

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page