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

40 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 8 customers, where each pair of numbers corresponds to:
Number of Items Purchased
Number of Store Visits
Customer 1(C1): (2 items, 10 visits)
Customer 2(C2): (2 items, 5 visits)
Customer 3(C3): (8 items, 4 visits)
Customer 4(C4): (5 items, 8 visits)
Customer 5(C5): (7 items, 5 visits)
Customer 6(C6): (6 items, 4 visits)
Customer 7(C7): (1 item, 2 visits)
Customer 8(C8): (4 items, 9 visits)
Initial Cluster Centers:
To start, use the following initial cluster centers based on specific customers:
Cluster 1 Center: Customer 1(C1)(2 items, 10 visits)
Cluster 2 Center: Customer 4(C4)(5 items, 8 visits)
Cluster 3 Center: Customer 7(C7)(1 item, 2 visits)
In Python, run the K-Means algorithm from scratch for3 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 8 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 built-in clustering functions (like those from scikit-learn) 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!