The dataset gender.xlsx contains names and their corresponding genders (Male/Female).
The Gender column is mapped to numerical values:
Male (M) is mapped to 1
Female (F) is mapped to 0
2. Feature Extraction (TF-IDF Vectorization)
The names are converted to TF-IDF vectors using character n-grams (1 to 3 characters).
This helps the model learn important patterns in names.
3. Model Training
A Neural Network is built using Keras Sequential API:
Dense layers with ReLU activation
Batch Normalization and Dropout layers to prevent overfitting
Output layer with Sigmoid activation for binary classification
The model is trained with callbacks like early stopping and learning rate reduction.
4. Saving the Model and Vectorizer
The trained model is saved as gender_prediction_model_Improve.h5
The TF-IDF vectorizer is saved as tfidf_vectorizer_Improve.joblib
5. Streamlit Application
Loads the pre-trained model and vectorizer.
Accepts user input (name) and predicts gender.
Displays the predicted gender in a clean UI.
📝 Project File Structure
.
├── TrainImprove.py # Training script for the model
├── ml-st1.py # Streamlit app for gender prediction
├── gender.xlsx # Dataset with names and gender
├── gender_prediction_model_Improve.h5 # Saved Keras model
├── tfidf_vectorizer_Improve.joblib # Saved TF-IDF vectorizer
└── screenshot.png # Screenshot of the app UI