Skip to main content

GenderPred-IN

GenderPred-IN is a Python package designed to predict the gender of a person based on their name. It is specifically tailored for Indian names, leveraging advanced machine learning techniques to provide prediction with accuracy ~96%.

PyPI

Features

  • LSTM Model: Utilizes a Long Short-Term Memory (LSTM) neural network model to understand the sequential patterns in names.

  • Tokenizer and Label Encoder: Processes names through a trained tokenizer and label encoder to convert names into a format suitable for the LSTM model.

  • Pre-trained Model: Comes with a pre-trained model, eliminating the need for extensive training and setup.

  • User-friendly: Simple and easy-to-use functions to get predictions with minimal setup.

Getting Started

Installation

You can install the package using pip (easy-peasy way):

pip  install  genderpred_in

or you can use github to install (harder way):

  1. Clone the repository:
git clone https://github.com/DhrvM/GenderPred-India.git

cd GenderPred-India
  1. Install the package:
pip install .
  1. Verify the installation:
pip list

Usage

Import Package

from genderpred_in import classify_name, get_name, get_first_name, get_male_probability, get_female_probability, get_gender

Here is an example of how to use the package:

# Classify the name "Rohit"

result = classify_name("Rohit")



# Retrieve and print the results

full_name = get_name(result)

first_name = get_first_name(result)

male_prob = get_male_probability(result)

female_prob = get_female_probability(result)

gender = get_gender(result)



print(f"Full Name: {full_name}")

print(f"First Name: {first_name}")

print(f"Male Probability: {male_prob}")

print(f"Female Probability: {female_prob}")

print(f"Gender: {gender}")

Example Output:

Full Name: Rohit

First Name: ROHIT

Male Probability: 0.9916077852249146

Female Probability: 0.008392222225666046

Gender: male

Functions

  • classify_name(full_name): Classifies the given full name and returns a dictionary with the name, first name, gender, and probabilities.

  • get_name(result): Retrieves the full name from the classification result.

  • get_first_name(result): Retrieves the first name from the classification result.

  • get_male_probability(result): Retrieves the male probability from the classification result.

  • get_female_probability(result): Retrieves the female probability from the classification result.

  • get_gender(result): Retrieves the predicted gender from the classification result. (Output: male, female, unknown)

Versions

Version 1.0.2 Fixed Model loading error for Windows.\

Version 1.0.1 Uses LSTM model with a tokenized First-Name to Generate Predictions of Gender.

Built With

  • TensorFlow - The machine learning framework used

  • Keras - High-level neural networks API

  • NumPy - Used for numerical computing

  • Pandas - Data manipulation and analysis

Authors

Dhruv Malpani - Initial Work

LinkedIn

GitHub

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

Praneeth Vasarla

Your article helped me create the initial model using Logistic Regression and n-grams. (article)

Release files for genderpred-in 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genderpred-in 1.0.3
File Size Uploaded
genderpred_in-1.0.3.tar.gz 1.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for genderpred-in 1.0.3
File Interpreter ABI Platform
genderpred_in-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 2.1 MB

Release files / genderpred_in-1.0.3.tar.gz

Download URL genderpred_in-1.0.3.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
7254cf3c38005faf1fcc514f5eab1c90ad27e3095ec005f036604a5b9061b7e7
BLAKE2b-256 checksum
How to use checksums
3c48efecef10366c25c604da6aeb8ecd7151b9cfa99c156d5ec26fa708fbfa64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release files / genderpred_in-1.0.3-py3-none-any.whl

Download URL genderpred_in-1.0.3-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
89b78e4d84825d3f47c3f17799507c0e813593d32b52926bcc19fc76947209f2
BLAKE2b-256 checksum
How to use checksums
81ed2ea1dff333956ab7fa1574e8ff20befdb113d52e495a079f66c0fea1a46c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release 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