Question: 4 0 Marks Study the scenario and complete the questions that follow: Clustering customers based on shopping behaviour You are tasked with analyzing customer shopping
Marks
Study the scenario and complete the questions that follow:
Clustering customers based on shopping behaviour
You are tasked with analyzing customer shopping behaviour to segment them into three distinct groups based on their shopping patterns.
Data Points:
The data below represents customers, where each pair of numbers corresponds to:
Number of Items Purchased
Number of Store Visits
Customer C: items, visits
Customer C: items, visits
Customer C: items, visits
Customer C: items, visits
Customer C: items, visits
Customer C: items, visits
Customer C: item, visits
Customer C: items, visits
Initial Cluster Centers:
To start, use the following initial cluster centers based on specific customers:
Cluster Center: Customer C items, visits
Cluster Center: Customer C items, visits
Cluster Center: Customer C item, visits
In Python, run the KMeans algorithm from scratch for rounds epochs on the data points in the scenario above. In each round, you will:
Assign each point to a cluster using the Euclidean distance formula.
Calculate the new centroids of each cluster based on the points assigned.
Create a chart showing all points, indicating which points belong to each cluster. Mark the centroids with a special symbol and use different colors for each cluster. Add labels and a legend for clarity. Thus in total you will have three charts, one for each round.
Important Notes:
No builtin clustering functions like those from scikitlearn are allowed. You must use basic Python constructs mathematical operations, loops, etc to manually calculate distances, assign clusters, and update centroids.
You may use libraries like numpy for array operations and matplotlib for visualizing the clusters and centroids.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
