Giter Club home page Giter Club logo

mb3152 / balanced_citer Goto Github PK

View Code? Open in Web Editor NEW
22.0 3.0 4.0 2.54 MB

This python script guesses the race and gender (probabilistically) of the first and last authors for papers in your citation list (in the form of a .bib file) and compares your list to expected distributions based on a model that accounts for paper characteristics (e.g., author location, author seniority, journal, et cetera.) unrelated to race and gender.

Python 28.95% TeX 71.05%
gender race bias

balanced_citer's Introduction

Balanced Citer

This python script guesses the race and gender (probabilistically) of the first and last authors for papers in your citation list (in the form of a .bib file) and compares your list to expected distributions based on a model that accounts for paper characteristics (e.g., author location, author seniority, journal, et cetera.) unrelated to race and gender.

Usage Example: python unbiasedciter.py -authors 'Maxwell Bertolero Danielle Bassett' -bibfile '/path/to/my/main.bib' -gender_key 'my_gender_key' -homedir '/you/where/you/keep/this_repo/' -bibname 'my_bib_results'

Requirements: (1) ethnicolr and pybtex; when you run the code, it will install then on the fly for you if you do not have them. (2) You also need a key from gender-api.com. This is free. (3) a .bib file that contains the citations you want to analyze.

This will create: Image

We only provide the usage of the Florida voter data first and last name model (a) from ethnicolr. This is because the census model (b) that only uses last names very often guesses that a Black author is white. Here is a "confusion" matrix, which measures the model's predictions, during cross validation. The diagonal number are the number of authors who are appropriately classified. The off diagonal entries are the number of errors.

Image

Moreover, we use probabilities, not binary classifications, so a single author's race, for example, is represented as weights across Asian, Black, Hispanic, and white. As such, this code should provide a sanity check / red flag for unbalanced refrences lists, not a ground truth.

balanced_citer's People

Contributors

mb3152 avatar ralcant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

balanced_citer's Issues

Cannot get this running - maybe Gender API key issue?

Looks like the readme and example calls for -gender_key to be passed, but the script asks for -myKey? Is that the same thing?

And I wasn't sure what to input for the gender_key. I set up an account with gender-api.com and got a key to use (a string of characters). Is that all I have to input in the call. Here's my call:

I used conda on Windows 10.

python unbiasedciter.py -authors 'Weisberg' -bibfile "C:\Users\smwei\Desktop\Splash\CogNeuro_Grad.bib" -myKey 'rWzoCS[redacted]' -homedir 'C:\Users\smwei\Documents\balanced_citer\'

And the error I get:

Traceback (most recent call last):
  File "unbiasedciter.py", line 83, in <module>
    with open(homedir + 'gender_base' + '.pkl', 'rb') as f:
OSError: [Errno 22] Invalid argument: "'C:\\Users\\smwei\\Documents\\balanced_citer\\'gender_base.pkl"

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.