Assignment 4
Set A
1. Read the dataset ([Link]) containing employee names and their salaries.
Apply K-Means clustering with k=2 to group employees into Low Salary and High
Salary categories. Display the cluster centers and the group assignment of each
employee.
Input ([Link]):
Name,Salary
John,40000
Alice,35000
Bob,60000
Eve,90000
Sam,80000
2. Given a set of 2D points:
(1,2), (2,3), (3,4), (8,8), (9,9), (10,10)
Apply K-Means clustering with k=2 to divide the points into two groups. Display the
cluster centers and the group assignment of each point.
Set B
Read the dataset ([Link]) with Age and Annual Income. Apply K-Means
clustering with 2 clusters and print the cluster labels for each data point.
Create a dataset of students with Marks in Maths and Science. Use K-Means
clustering (k=3) to group students into performance levels. Print the cluster centers.
Use the dataset ([Link]) with columns Price and Sales. Cluster products into 3
groups (Low, Medium, High selling products). Print cluster centers and plot the result.
Set C
1. Apply K-Means clustering on the Iris dataset (from sklearn).Use features:
SepalLength, SepalWidth, PetalLength, PetalWidth. Cluster into 3 groups. Compare
cluster labels with actual species
2. Implement K-Means clustering from scratch (without using sklearn). Apply it on a
dataset of 2D points