This repository contains a simple yet effective neural network built with PyTorch for customer segmentation based on demographic and behavioral features.
customer-segmentation-NN/
│
├── data/ # Dataset location (after download)
│ └── external/
│ └── customer.zip
│
├── models/
│ ├── base_model.py # CustomerSegmentationModel class
│ ├── neural_net.py # PyTorch neural network architecture
│ └── init.py # Main script for training and evaluation
│
├── utils/
│ ├── get_data.py # Download utility
│ └── zip.py # ZIP extraction utility
│
├── run.py # Entry point to automate the full pipeline
└── README.md # Project documentation
- Downloads customer segmentation dataset from Kaggle
- Preprocesses demographic and behavioral features
- Encodes categorical variables
- Trains a feedforward neural network with dropout and ReLU
- Evaluates performance (accuracy, classification report)
- Computes basic feature importance based on model weights
git clone https://github.com/your-username/customer-segmentation-NN.git
cd customer-segmentation-NNIt's recommended to use a virtual environment:
pip install -r requirements.txtpython src/init.pyThis will:
- Download the dataset
- Extract it
- Train the model
- Display evaluation results and feature importance
- Input → Linear(128) → ReLU → Dropout
- → Linear(64) → ReLU → Dropout
- → Linear(output classes)
- Training Loss and Accuracy plots
- Test Accuracy
- Classification Report
- Feature Importance Ranking
- Sample Predictions with Probabilities
Dataset source: Kaggle - Customer Segmentation Dataset
Features include:
- Demographic: Gender, Age, Married status, Education, Profession, etc.
- Behavioral: Spending Score, Work Experience
This project is licensed under the MIT License. Feel free to use, modify, and contribute!