Question 4.1
Describe a situation or problem from your job, everyday life, current events, etc., for which a
clustering model would be appropriate. List some (up to 5) predictors that you might use.
I run Seba AI, an agency that builds AI voice agents for small and mid-sized businesses. Over
a few hundred inbound leads, I have no clean labels for "good fit" versus "bad fit," but I do
have a lot of descriptive data on each business. Clustering would let me discover natural
segments in the lead base so I can tailor outreach, pricing, and the demo script to each
segment instead of treating every lead the same. Unlike a classification model, I am not
trying to predict a known label; I am trying to find the structure that is already there.
Predictors I would use:
Monthly inbound call volume (quantitative): the single best proxy for how much pain
a missed-call problem causes, and a strong driver of willingness to pay.
Average call-handling time (quantitative): businesses with long, repetitive calls
(scheduling, FAQs) cluster differently from those with short transactional calls.
Number of front-desk / phone staff (quantitative): a proxy for the labor cost a voice
agent could offset.
Industry vertical (categorical, one-hot encoded): home services, healthcare scheduling,
and professional services have very different call patterns and tend to fall into different
clusters.
After-hours call fraction (quantitative, 0 to 1): businesses losing many calls outside
business hours are a distinct, high-value segment.
I would standardize the quantitative predictors before clustering (so call volume in the
hundreds does not dominate a 0-to-1 fraction), one-hot encode the vertical, and use k-
means with an elbow plot to choose k. The resulting clusters would become named sales
segments ("high-volume after-hours home services," "low-volume professional services,"
and so on).
Question 4.2
The iris data set contains 150 points, four predictors, and one categorical response
(species). Use kmeans to cluster the points as well as possible. Report the best combination
of predictors, the suggested k, and how well the best clustering predicts flower type. The
response is used only to score the result, never to build the model.
Methodology
I loaded the iris data (150 rows, four numeric predictors: Sepal.Length, Sepal.Width,
Petal.Length, Petal.Width). The species labels were held out and used only afterward to
,score the clusters. I standardized every predictor with scale() before clustering so that
each contributes comparably to the Euclidean distance that k-means uses (the four
measurements are all in centimeters but have different spreads, and petal measurements
would otherwise carry different weight than sepal measurements purely because of
variance). Every kmeans call used nstart = 25 so the algorithm restarts from 25
random initializations and keeps the best, which avoids unlucky local optima, and
set.seed(42) for reproducibility.
To score a clustering without using labels to fit it, I assigned each cluster to its majority
species (the species most common among that cluster's members), then computed the
fraction of points whose majority-vote label matched their true species. This is the standard
way to measure how well an unsupervised clustering recovers a known grouping.
I worked in three steps:
1. Choose k with an elbow plot of total within-cluster sum of squares (WSS) on all four
standardized predictors.
2. Search predictor subsets at the chosen k and pick the most accurate combination.
3. Confirm k for the winning combination by sweeping k from 2 to 5.
Results
Step 1, elbow plot (all four predictors, scaled):
k Total within-cluster SS
1 596.00
2 220.88
3 138.89
4 113.33
5 90.20
6 79.47
WSS drops steeply from k=1 to k=3, then flattens. The elbow is at k=3, which also matches
the known number of species.
, Elbow plot of total within-cluster sum of squares vs k. The bend at k=3 motivates the choice of three
clusters.
Step 2, predictor-subset search at k=3:
Combination Accuracy vs species Total within-SS
Petal.Length + Petal.Width 0.9600 17.91
Petal.Width only 0.9600 8.46
Petal.Length only 0.9467 7.87
Petal.Length + Petal.Width + 0.8667 62.62
Sepal.Length
All 4 predictors 0.8333 138.89
Sepal.Length + Sepal.Width 0.7733 101.93
The two petal measurements are by far the most informative. Petal.Length + Petal.Width
and Petal.Width alone both hit 96% accuracy. Adding the sepal measurements actively hurts
accuracy (all four predictors fall to 83%) because the sepal dimensions overlap heavily
between versicolor and virginica and add noise to the distance metric.
Step 3, confirm k for Petal.Length + Petal.Width:
k Accuracy Total within-SS
2 0.6667 53.81
3 0.9600 17.91
4 0.9467 12.20
5 0.9533 9.08
k=2 collapses two species together (67%). k=3 is the clear best on accuracy; k=4 and k=5
keep WSS falling but do not improve recovery of the true species, which is exactly what we
expect when we split real groups into artificial sub-groups.
Final model: Petal.Length + Petal.Width, k=3. Cluster-vs-species cross-tab: