ethnicolr2

Ethnicolr implementation with new models in pytorch

https://github.com/appeler/ethnicolr2

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.0%) to scientific vocabulary

Keywords

ethnicity machine-learning names pytorch race
Last synced: 6 months ago · JSON representation ·

Repository

Ethnicolr implementation with new models in pytorch

Basic Info
  • Host: GitHub
  • Owner: appeler
  • License: mit
  • Language: Jupyter Notebook
  • Default Branch: main
  • Homepage:
  • Size: 38.8 MB
Statistics
  • Stars: 13
  • Watchers: 4
  • Forks: 4
  • Open Issues: 0
  • Releases: 0
Topics
ethnicity machine-learning names pytorch race
Created over 2 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation

README.md

ethnicolr2: Predict Race and Ethnicity From Name

image image image

A Pytorch implementation of ethnicolr with new models that make different assumptions (for instance, this package has models trained on unique names) than ethnicolr. The package uses the US census data and the Florida voting registration data to build models to predict the race and ethnicity (non-Hispanic whites, non-Hispanic Blacks, Asians, Hispanics, and Other) based on first and last name or just the last name. For notebooks underlying the package, see here.

Caveats and Notes

If you picked a random person with the last name \'Smith\' in the US in 2010 and asked us to guess this person\'s race (as measured by the census), the best guess is the modal race of the person named Smith (which you can get from the census popular last name data file). It is the Bayes Optimal Solution. So what good are predictive models? A few things---if you want to impute race and ethnicity for last names that are not in the census file, which can be because of errors, infer the race and ethnicity in different years than when the census was conducted (if some assumptions hold), infer the race of people in different countries (if some assumptions hold), etc. The biggest benefit comes in cases where both the first and last name are known.

Install

We strongly recommend installing [ethnicolor2]{.title-ref} inside a Python virtual environment (see venv documentation)

pip install ethnicolr2

Example

To predict race/ethnicity using the Florida Last Name Model to a file with first and last names

import pandas as pd
from ethnicolr2 import pred_fl_last_name, pred_fl_full_name 
df = pd.read_csv("ethnicolr2/data/input-with-header.csv")
pred_fl_last_name(df, lname_col = "last_name")


names = [
 {"last": "sawyer", "first": "john", "true_race": "nh_white"},
 {"last": "torres", "first": "raul", "true_race": "hispanic"},
]
df = pd.DataFrame(names)
df = pred_fl_full_name(df, lname_col = "last", fname_col = "first")

      last  first true_race   preds
0  sawyer   john  nh_white nh_white
1  torres   raul  hispanic hispanic

Authors

Rajashekar Chintalapati, Suriyan Laohaprapanon, and Gaurav Sood

Contributor Code of Conduct

The project welcomes contributions from everyone! In fact, it depends on it. To maintain this welcoming atmosphere and to collaborate in a fun and productive way, we expect contributors to the project to abide by the Contributor Code of Conduct.

🔗 Adjacent Repositories

  • appeler/ethnicolr — Predict Race and Ethnicity Based on the Sequence of Characters in a Name
  • appeler/ethnicolor — Race and Ethnicity based on name using data from census, voter reg. files, etc.
  • appeler/instate — instate: predict the state of residence from last name using the indian electoral rolls
  • appeler/parsernaam — AI name parsing. Predict first or last name using a DL model.
  • appeler/naamkaran — generative model for names

Owner

  • Name: appeler
  • Login: appeler
  • Kind: organization

Making sense of names.

Citation (Citation.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Chintalapati"
  given-names: "Rajashekar"
- family-names: "Laohaprapanon"
  given-names: "Suriyan"
- family-names: "Sood"
  given-names: "Gaurav"
title: "ethnicolr2: Predict Race and Ethnicity From Name"
version: 0.1.1
date-released: 2023-08-17
url: "https://github.com/appeler/ethnicolr2"

GitHub Events

Total
  • Watch event: 4
  • Delete event: 3
  • Push event: 29
  • Pull request event: 9
  • Fork event: 2
  • Create event: 3
Last Year
  • Watch event: 4
  • Delete event: 3
  • Push event: 29
  • Pull request event: 9
  • Fork event: 2
  • Create event: 3

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 2
  • Total pull requests: 13
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 11
Past Year
  • Issues: 0
  • Pull requests: 7
  • Average time to close issues: N/A
  • Average time to close pull requests: 16 minutes
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 5
Top Authors
Issue Authors
  • jcweaver (2)
Pull Request Authors
  • dependabot[bot] (11)
  • epicfaace (2)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels
dependencies (11) python (5)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 356 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 2
pypi.org: ethnicolr2

Predict Race/Ethnicity Based on Sequence of Characters in the Name

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 356 Last month
Rankings
Dependent packages count: 7.5%
Forks count: 30.3%
Average: 36.7%
Stargazers count: 39.2%
Dependent repos count: 69.7%
Maintainers (2)
Last synced: 6 months ago