A Machine Learning & Deep Learning application that predicts whether a given name is Female or Male using character-level TF-IDF Vectorization and a TensorFlow / Keras Neural Network.
🚀 Note: I build this interactive Streamlit frontend for this project with Antigravity.
- ⚡ Real-time Single Name Prediction: Instant gender prediction with confidence scores (%) and probability breakdown.
- 📋 Batch Processing: Predict gender for multiple names simultaneously via multi-line text input or CSV file upload (
namecolumn). - 📥 Export Results: One-click download of batch prediction results as a CSV file (
gender_classification_results.csv). - 🧹 Smart Preprocessing: Automatic text cleaning that normalizes case, removes titles, address codes (
r/o,c/o,so,do), numbers, and extra spaces. - 📊 Interactive Analytics & Insights: Sidebar and tabs providing insights into model architecture, n-grams, and training accuracy.
- Preprocessing: Cleans raw names by removing relationship/address keywords (
r/o,c/o,urf,so,do,ps), digits, and normalizing whitespace. - Feature Extraction: Character-level TF-IDF Vectorizer using
ngram_range=(2, 5)with a maximum of10,000features. - Deep Learning Classifier:
- Layer 1: Dense (64 units, ReLU activation)
- Layer 2: Dropout (0.3 rate for regularization)
- Layer 3: Dense (32 units, ReLU activation)
- Output Layer: Dense (1 unit, Sigmoid activation)
- Model Performance: Achieves ~87.5% Accuracy on a test split of 125,000+ names.
├── app.py # Streamlit Web Application (Built with Antigravity)
├── gender_classification_model.h5 # Pre-trained Keras Model (.h5 format)
├── gender_model.keras # Keras Model (.keras format)
├── tfidf_vectorizer.pkl # Saved TF-IDF Character Vectorizer
├── label_encoder.pkl # Saved Label Encoder ('f' -> 0, 'm' -> 1)
├── Names_dataset.csv # Dataset containing names and gender labels
├── gender-classification-model.ipynb # Training & Exploratory Data Analysis Notebook
├── requirements.txt # Python Dependencies
├── .gitignore # Git Ignore file
└── README.md # Project Documentation
git clone https://github.com/Pranamchand/Gender-Classification-Model-based-on-Name.git
cd Gender-Classification-Model-based-on-Namepython -m venv .venv
# On Windows:
.\.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activate
pip install -r requirements.txtstreamlit run app.pyThe web application will open automatically in your browser at http://localhost:8501.