Skip to content

sakuna47/Customer_Segmentation_with_Clustering

Repository files navigation

Customer Segmentation with K-Means Clustering

Overview

This project performs customer segmentation using K-Means clustering on the "Mall Customers" dataset. It includes data preprocessing, visualization, clustering using the Elbow Method, and deployment with Streamlit for interactive analysis.

Features

  • Load and preprocess customer data.
  • Perform K-Means clustering on Annual Income and Spending Score.
  • Use the Elbow Method to determine the optimal number of clusters.
  • Visualize the clusters using Seaborn and Matplotlib.
  • Deploy an interactive Streamlit app for user-friendly exploration.
  • Save clustered data to Google Drive for further analysis.

Dataset

The dataset contains the following attributes:

  • Customer ID: Unique identifier for each customer.
  • Gender: Gender of the customer.
  • Age: Age of the customer.
  • Annual Income (k$): Annual income in thousands of dollars.
  • Spending Score (1-100): A measure of spending habits.

Installation

Ensure you have the following libraries installed:

pip install pandas numpy matplotlib seaborn scikit-learn streamlit

Running the Script

  1. Mount Google Drive (for Google Colab users):

    from google.colab import drive
    drive.mount('/content/drive')
  2. Run the Python script:

    python clustering_script.py
  3. Run the Streamlit app:

    streamlit run app.py

File Structure

├── clustering_script.py  # Main script for clustering
├── app.py                # Streamlit app for visualization
├── Mall_Customers.csv    # Input dataset
├── clustered_customers.csv # Output file with cluster labels
├── README.md             # Project documentation

Results

  • The dataset is clustered into 5 groups based on annual income and spending score.
  • Customers can be visualized in different clusters using an interactive Streamlit app.

Contributions

Feel free to fork this repository, make changes, and submit pull requests. Contributions are welcome!

License

This project is open-source under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published