A Package to Predict the Gender of a Person based on their Name (Suited for Indian Names)
Project description
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%.
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):
- Clone the repository:
git clone https://github.com/DhrvM/GenderPred-India.git
cd GenderPred-India
- Install the package:
pip install .
- 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
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Acknowledgments
Your article helped me create the initial model using Logistic Regression and n-grams. (article)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file genderpred_in-1.0.3.tar.gz
.
File metadata
- Download URL: genderpred_in-1.0.3.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7254cf3c38005faf1fcc514f5eab1c90ad27e3095ec005f036604a5b9061b7e7 |
|
MD5 | ea20f2d4e424655c1cd827d40cace5aa |
|
BLAKE2b-256 | 3c48efecef10366c25c604da6aeb8ecd7151b9cfa99c156d5ec26fa708fbfa64 |
File details
Details for the file genderpred_in-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: genderpred_in-1.0.3-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89b78e4d84825d3f47c3f17799507c0e813593d32b52926bcc19fc76947209f2 |
|
MD5 | 8a2c8cea77cce846d645ed4a0a2e3587 |
|
BLAKE2b-256 | 81ed2ea1dff333956ab7fa1574e8ff20befdb113d52e495a079f66c0fea1a46c |