GithubHelp home page GithubHelp logo

xrosliang / dataset-replication-analysis Goto Github PK

View Code? Open in Web Editor NEW

This project forked from madrylab/dataset-replication-analysis

0.0 0.0 0.0 37 KB

License: MIT License

Python 42.62% Jupyter Notebook 57.38%

dataset-replication-analysis's Introduction

Identifying Statistical Bias in Dataset Replication

Code for the paper "Identifying Statistical Bias in Dataset Replication." The original paper is here (blog post) .

Annotation Data

Annotation data not included in the Git repository is necessary to run any analyses (approx 2 GB). The annotation data can be found here. There are two Pandas dataframes saved with pytorch (e.g. load them with torch.load(path)) that correspond to both the raw annotation data and the data cleaned version (data cleaning described in paper). The is also a dataframe containing raw data from the original ImageNet-v2 study, which is required by run_orig_data.py.

Beta-Binomial fitting

To adjust for accuracy using parametric modelling (cf. Section 5.3), run run_betabinom.py while inputting the path of a dataframe retrieved from the "Annotation Data" section above to --df-path.

usage: run_betabinom.py [-h] --out-dir OUT_DIR --df-path DF_PATH [--debug]

optional arguments:
  -h, --help         show this help message and exit
  --out-dir OUT_DIR  Out directory to save results to
  --df-path DF_PATH  Input dataframe to draw annotations from
  --debug

For example:

python run_betabinom.py --df-path df_clean.pt --out-dir output/

After this program runs, to visualize/parse the results you will need to open up the iPython notebook src/Beta-Binomial Model Analysis.ipynb and replace the INPUT_DATA variable as instructed by the printout at the end of run_betabinom.py before running all the cells. The notebook will output both a visualization as well as a Pandas dataframe with accuracies and adjusted accuracies for each model.

Jackknife fitting

Similarly, run_jackknife.py will run the statistical jackknife correction (cf. Section 5.2) using the dataframe retrieved from the "Annotation Data" section above.

usage: run_jackknife.py [-h] --out-dir OUT_DIR --df-path DF_PATH [--debug]

optional arguments:
  -h, --help          show this help message and exit
  --out-dir OUT_DIR   Out directory to save results to
  --df-path DF_PATH   Input dataframe to draw annotations from
  --delete-d D        Runs the delete-D jackknife (default 1)
  --num-replicates N  Number of replicates to use to estimate expectations (default 100)
  --workers W         Number of threads to use (default 2)
  --save-justification    Also output plot of bias vs 1/n (cf. Figure 12)

For example:

python run_jackknife.py --df-path df_clean.pt --out-dir output/ --save-justification

Original data analysis

Finally, to run the analysis in Appendix D (original data analysis), run analyze_orig_data.py using the dataframe dowloaded in the first section.

usage: analyze_orig_data.py [-h] --out-dir OUT_DIR --df-path DF_PATH --experiment {naiveest, heldout, ezflickr}

optional arguments:
  -h, --help         show this help message and exit
  --out-dir OUT_DIR  Out directory to save results to
  --df-path DF_PATH  Input dataframe to draw annotations from
  --experiment       Which Appendix D experiment to run (D.1, D.2, D.3)
  --workers          Number of threads to use (default 2)
  --trials           Number of trials to average over (default 10)

dataset-replication-analysis's People

Contributors

lengstrom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.