Skip to main content

Predict religion and caste based on name

Project description Documentation Status

Pranaam uses the Bihar Land Records data, plot-level land records (N= 41.87 million plots or 12.13 individuals/accounts across 35,626 villages), to build machine learning models that predict religion and caste from the name. Our final dataset has around 4M unique records. To learn how to transform the data and the models underlying the package, check the notebooks.

The first function we are releasing with the package is pred_rel, which predicts religion based on the name (currently only muslim or not). (For context, nearly 95% of India’s population are Hindu or Muslim, with Sikhs, Buddhists, Christians, and other groups making up the rest.) The OOS accuracy assessed on unseen names is nearly 98% for both Hindi and English models.

Our training data is Hindi. To build models that classify names provided in English, we used the indicate package to transliterate our training data to English.

We are releasing this software in the hope that it enables activists and researchers.

  1. Highlight biases,

  2. Fight biases, and

  3. Prevent biases (regress out some of these biases in models built on natural language corpus with person names).


We strongly recommend installing pranaam inside a Python virtual environment. (see venv documentation)

pip install pranaam

General API

  1. pranaam.pred_rel takes a list of Hindi/English names and predicts whether the person is Muslim or not.


By using names in English

from pranaam import pranaam
names = ["Shah Rukh Khan", "Amitabh Bachchan"]
result = pranaam.pred_rel(names)

output -

              name  pred_label  pred_prob_muslim
0    Shah Rukh Khan      muslim              73.0
1  Amitabh Bachchan  not-muslim              27.0

By using names in Hindi

from pranaam import pranaam
names = ["शाहरुख खान", "अमिताभ बच्चन"]
result = pranaam.pred_rel(names, lang="hin")

output -

          name  pred_label  pred_prob_muslim
0    शाहरुख खान      muslim              73.0
1  अमिताभ बच्चन  not-muslim              27.0


We expose one function, which takes Hindi/English text (name) and predicts religion and caste.

  • pranaam.pred_rel(input)

    • What it does:

      • predicts religion based on hindi/english text (name)

    • Output

      • Returns pandas with name and label (muslim/not-muslim)


Rajashekar Chintalapati, Aaditya Dar, and Gaurav Sood

Contributor Code of Conduct

The project welcomes contributions from everyone! 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.


The package is released under the MIT License.

Project details

Download files

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

Source Distribution

pranaam-0.0.2.tar.gz (88.5 kB view hashes)

Uploaded Source

Built Distribution

pranaam-0.0.2-py2.py3-none-any.whl (91.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page