This project implements an end-to-end gender classification model using the gender_classification_v7.csv dataset. The model predicts gender (Male/Female) based on 7 physical features.
Project Structure
src/eda_and_preprocessing.py: Script for Exploratory Data Analysis and Data Preprocessing.
src/train_model.py: Script for training and evaluating models (Logistic Regression, Random Forest, SVM).
src/inference.py: Script for making predictions on new data.
data/: Directory containing processed data.
models/: Directory containing saved models and scalers.
Setup
Ensure you have Python installed.
Install dependencies:
pip install pandas numpy scikit-learn joblib
Usage
1. Preprocessing
Run the preprocessing script to clean, encode, and scale the data.
python src/eda_and_preprocessing.py
2. Training
Run the training script to train the models and save the best one.
python src/train_model.py
Models trained:
Logistic Regression
Random Forest
Support Vector Machine (SVM)
The best model is automatically saved to models/best_model.pkl.
3. Inference
Use the inference script to predict gender from features.
python src/inference.py
4. Flask Web Application
To run the web interface:
Navigate to the project directory.
Run the Flask app:
python app.py
Open your browser and go to http://127.0.0.1:5000.
Enter the physical attributes in the form and click "Predict Gender".