Lesson 1, Topic 1
In Progress

Statistical Analysis Challenge Week 2

Kedeisha August 24, 2023

The Week 2 Data Science Challenge is here! You’ll spend this week learning about customer segmentation, a key component of retail analytics. Businesses frequently have a diverse customer base, and for effective marketing and service delivery, it is essential to comprehend the various customer types.

Areas of Practice:

  1. Clustering Algorithms: You will get hands-on experience with clustering algorithms, specifically K-means, to segment customers into different groups.
  2. Data Preprocessing: Learn the importance of scaling and normalizing your data before feeding it into a machine learning algorithm.
  3. Data Visualization: Use data visualization tools to understand the clusters formed and to present your findings effectively.
  4. Business Insight Extraction: Go beyond the algorithm to interpret what the clusters mean in a business context.
  5. Python Programming: Utilize Python libraries like scikit-learn, pandas, and matplotlib for clustering and visualization.


You work as a data scientist for a retailer with both physical and online stores. The business has gathered information about customer purchases and plans to segment its clientele for more precise marketing campaigns.


Your task is to perform customer segmentation using K-means clustering based on the available features: Age, Annual Income, and Spending Score (a score assigned by the company based on customer behavior and spending nature).

Download data here.


  1. Import the data and perform initial data inspection.
  2. Visualize the distribution of each feature to understand its spread.
  3. Use pairplot or scatterplot matrices to visualize the relationships between features.
  4. Use the Elbow Method to determine the optimal number of clusters for the K-means algorithm.
  5. Fit the K-means algorithm to the data using the optimal number of clusters determined in Task 4.
  6. Analyze the centroids of the clusters to understand what each cluster represents.
  7. Add the cluster labels back to the original dataset and examine some sample records from each cluster.
  8. Write a brief report summarizing your methodology, findings, and any recommendations you have for the company based on your analysis.

By completing these tasks, you will not only perform a complete clustering analysis but also interpret your model’s findings to generate business insights. This will give you a good idea of how data science can drive decision-making processes in a business context. Good luck!

Submission Instructions

Those who submit an entry will be eligible to win a free copy of any book of their choice by Packt! The more weeks you participate, the more chances you get to win! To submit your entries, make a LinkedIn post with a screenshot of your answers. You can explain your thought process if you’d like. Just make sure to tag the Data in Motion LLC company page.