Welcome to the Mall Customer Segmentation project! This project focuses on analyzing mall customer data to group them into segments based on their behavior.
Customer segmentation involves dividing customers into groups based on common characteristics. In this project, we use clustering algorithms to segment mall customers by analyzing their spending patterns and income levels.
The dataset contains the following columns:
- CustomerID: Unique ID 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): Score assigned by the mall based on customer spending behavior
- Clone the repository:
git clone <repository_url>- Navigate to the project directory:
cd Mall_Customer_Segmentation- Install required libraries:
pip install -r requirements.txt- Run the Jupyter notebook:
jupyter notebook Mall_Customer_Segmentation.ipynbimport pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.cluster import KMeansdf = pd.read_csv('Mall_Customers.csv')
df.head()X = df[['Annual Income (k$)', 'Spending Score (1-100)']]wcss = []
for i in range(1, 11):
kmeans = KMeans(n_clusters=i, init='k-means++', random_state=42)
kmeans.fit(X)
wcss.append(kmeans.inertia_)plt.plot(range(1, 11), wcss)
plt.title('The Elbow Method')
plt.xlabel('Number of clusters')
plt.ylabel('WCSS')
plt.show()kmeans = KMeans(n_clusters=6, init='k-means++', random_state=69)
y_kmeans = kmeans.fit_predict(X)The customers are segmented into 6 groups:
- Cluster 1: High income, low spending
- Cluster 2: Average income, average spending
- Cluster 3: Low income, high spending
- Cluster 4: High income, high spending
- Cluster 5: Low income, low spending
- Cluster 6: Moderate income, moderate spending
- Try other clustering algorithms.
- Integrate customer demographics for more refined segments.
Contributions are welcome! Please create an issue or pull request for any improvements.
For questions or collaboration, feel free to reach out!
⭐ Happy Coding! ⭐