# 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](https://pypi.org/project/genderpred-in/1.0.1/)
### 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):**
```bash
pip install genderpred_in
```
**or you can use **github** to install (harder way):**
1. Clone the repository:
```bash
git clone https://github.com/DhrvM/GenderPred-India.git
cd GenderPred-India
```
3. Install the package:
```bash
pip install .
```
5. Verify the installation:
```bash
pip list
```
### Usage
**Import Package**
```python
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:**
```python
# 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:
```bash
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](https://www.tensorflow.org/) - The machine learning framework used
- [Keras](https://keras.io/) - High-level neural networks API
- [NumPy](https://numpy.org/) - Used for numerical computing
- [Pandas](https://pandas.pydata.org/) - Data manipulation and analysis
## Authors
**Dhruv Malpani** - Initial Work
[LinkedIn](https://www.linkedin.com/in/dhruv-malpani/)
[GitHub](https://github.com/DhrvM)
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
## Acknowledgments
[**Praneeth Vasarla**](https://medium.com/@praneethvaasarla)
Your article helped me create the initial model using Logistic Regression and n-grams. ([article](https://medium.com/@praneethvaasarla/how-i-used-nlp-to-predict-the-gender-for-indian-names-df0ae30c275b))
Raw data
{
"_id": null,
"home_page": "https://github.com/DhrvM/GenderPred-India",
"name": "genderpred-in",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "gender, indian, names, LSTM, tensorflow, keras, classify, prediction",
"author": "Dhruv Malpani",
"author_email": "dhruv.malpani2005@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/3c/48/efecef10366c25c604da6aeb8ecd7151b9cfa99c156d5ec26fa708fbfa64/genderpred_in-1.0.3.tar.gz",
"platform": null,
"description": "\r\n\r\n# GenderPred-IN\r\n\r\nGenderPred-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%.\r\n\r\n[PyPI](https://pypi.org/project/genderpred-in/1.0.1/)\r\n\r\n\r\n\r\n### Features\r\n\r\n- LSTM Model: Utilizes a Long Short-Term Memory (LSTM) neural network model to understand the sequential patterns in names.\r\n\r\n- Tokenizer and Label Encoder: Processes names through a trained tokenizer and label encoder to convert names into a format suitable for the LSTM model.\r\n\r\n- Pre-trained Model: Comes with a pre-trained model, eliminating the need for extensive training and setup.\r\n\r\n- User-friendly: Simple and easy-to-use functions to get predictions with minimal setup.\r\n\r\n\r\n\r\n\r\n\r\n## Getting Started\r\n\r\n### Installation\r\n\r\n**You can install the package using pip (easy-peasy way):**\r\n\r\n```bash\r\n\r\npip install genderpred_in\r\n\r\n```\r\n\r\n**or you can use **github** to install (harder way):**\r\n\r\n\r\n\r\n 1. Clone the repository:\r\n\r\n ```bash\r\n\r\n git clone https://github.com/DhrvM/GenderPred-India.git\r\n\r\ncd GenderPred-India\r\n\r\n ```\r\n\r\n 3. Install the package:\r\n\r\n ```bash\r\n\r\n pip install .\r\n\r\n```\r\n\r\n 5. Verify the installation:\r\n\r\n ```bash\r\n\r\n pip list\r\n\r\n ```\r\n\r\n\r\n\r\n### Usage\r\n\r\n\r\n\r\n**Import Package**\r\n\r\n```python\r\n\r\nfrom genderpred_in import classify_name, get_name, get_first_name, get_male_probability, get_female_probability, get_gender\r\n\r\n```\r\n\r\n**Here is an example of how to use the package:**\r\n\r\n```python\r\n\r\n# Classify the name \"Rohit\"\r\n\r\nresult = classify_name(\"Rohit\")\r\n\r\n\r\n\r\n# Retrieve and print the results\r\n\r\nfull_name = get_name(result)\r\n\r\nfirst_name = get_first_name(result)\r\n\r\nmale_prob = get_male_probability(result)\r\n\r\nfemale_prob = get_female_probability(result)\r\n\r\ngender = get_gender(result)\r\n\r\n\r\n\r\nprint(f\"Full Name: {full_name}\")\r\n\r\nprint(f\"First Name: {first_name}\")\r\n\r\nprint(f\"Male Probability: {male_prob}\")\r\n\r\nprint(f\"Female Probability: {female_prob}\")\r\n\r\nprint(f\"Gender: {gender}\")\r\n\r\n```\r\n\r\n\r\n\r\n### Example Output:\r\n\r\n\r\n\r\n```bash\r\n\r\nFull Name: Rohit\r\n\r\nFirst Name: ROHIT\r\n\r\nMale Probability: 0.9916077852249146\r\n\r\nFemale Probability: 0.008392222225666046\r\n\r\nGender: male\r\n\r\n```\r\n\r\n\r\n\r\n### Functions\r\n\r\n- `classify_name(full_name)`: Classifies the given full name and returns a dictionary with the name, first name, gender, and probabilities.\r\n\r\n- `get_name(result)`: Retrieves the full name from the classification result.\r\n\r\n- `get_first_name(result)`: Retrieves the first name from the classification result.\r\n\r\n- `get_male_probability(result)`: Retrieves the male probability from the classification result.\r\n\r\n- `get_female_probability(result)`: Retrieves the female probability from the classification result.\r\n\r\n- `get_gender(result)`: Retrieves the predicted gender from the classification result. (Output: *male, female, unknown*)\r\n\r\n\r\n\r\n## Versions\r\n\r\n`Version 1.0.2` Fixed Model loading error for Windows.\\\r\n\r\n`Version 1.0.1` Uses LSTM model with a tokenized First-Name to Generate Predictions of Gender.\r\n\r\n\r\n\r\n\r\n\r\n## Built With\r\n\r\n\r\n\r\n- [TensorFlow](https://www.tensorflow.org/) - The machine learning framework used\r\n\r\n- [Keras](https://keras.io/) - High-level neural networks API\r\n\r\n- [NumPy](https://numpy.org/) - Used for numerical computing\r\n\r\n- [Pandas](https://pandas.pydata.org/) - Data manipulation and analysis\r\n\r\n\r\n\r\n## Authors\r\n\r\n**Dhruv Malpani** - Initial Work\r\n\r\n[LinkedIn](https://www.linkedin.com/in/dhruv-malpani/)\r\n\r\n[GitHub](https://github.com/DhrvM)\r\n\r\n\r\n\r\n## License\r\n\r\n\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.\r\n\r\n\r\n\r\n## Acknowledgments\r\n\r\n[**Praneeth Vasarla**](https://medium.com/@praneethvaasarla)\r\n\r\nYour article helped me create the initial model using Logistic Regression and n-grams. ([article](https://medium.com/@praneethvaasarla/how-i-used-nlp-to-predict-the-gender-for-indian-names-df0ae30c275b))\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Package to Predict the Gender of a Person based on their Name (Suited for Indian Names)",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/DhrvM/GenderPred-India"
},
"split_keywords": [
"gender",
" indian",
" names",
" lstm",
" tensorflow",
" keras",
" classify",
" prediction"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "81ed2ea1dff333956ab7fa1574e8ff20befdb113d52e495a079f66c0fea1a46c",
"md5": "8a2c8cea77cce846d645ed4a0a2e3587",
"sha256": "89b78e4d84825d3f47c3f17799507c0e813593d32b52926bcc19fc76947209f2"
},
"downloads": -1,
"filename": "genderpred_in-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8a2c8cea77cce846d645ed4a0a2e3587",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 1051235,
"upload_time": "2024-06-13T05:23:55",
"upload_time_iso_8601": "2024-06-13T05:23:55.972996Z",
"url": "https://files.pythonhosted.org/packages/81/ed/2ea1dff333956ab7fa1574e8ff20befdb113d52e495a079f66c0fea1a46c/genderpred_in-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3c48efecef10366c25c604da6aeb8ecd7151b9cfa99c156d5ec26fa708fbfa64",
"md5": "ea20f2d4e424655c1cd827d40cace5aa",
"sha256": "7254cf3c38005faf1fcc514f5eab1c90ad27e3095ec005f036604a5b9061b7e7"
},
"downloads": -1,
"filename": "genderpred_in-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "ea20f2d4e424655c1cd827d40cace5aa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 1053488,
"upload_time": "2024-06-13T05:23:58",
"upload_time_iso_8601": "2024-06-13T05:23:58.357095Z",
"url": "https://files.pythonhosted.org/packages/3c/48/efecef10366c25c604da6aeb8ecd7151b9cfa99c156d5ec26fa708fbfa64/genderpred_in-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-13 05:23:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DhrvM",
"github_project": "GenderPred-India",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "genderpred-in"
}