Changing the number of clusters and the scale can change how the same data are grouped. Interpret the structure without assigning meaning to cluster numbers themselves.
Run import numpy as np and import matplotlib.pyplot as plt in a code cell before the practice code. Use np for array operations and plt for plots.
Before practice
01 Does cluster number 0 have a special meaning?
Description
Numbers are arbitrary identifiers, so compare clusters using their centers and assignment structure.
02 Do different feature units change distances?
Description
Features with larger ranges can dominate distances, so compare results before and after Standardization.
Use make_blobs(n_samples=180,centers=3,cluster_std=.8,random_state=7) and .
Procedure
Train KMeans(random_state=7,n_init=10) for each K.
Plot cluster centers and assignments, and record Inertia and Silhouette.
Results to retain
Three cluster plots and a metrics table.
Items to record and points to check
K
Inertia
Silhouette
Observations by cluster count
Points to check
Did you avoid interpreting cluster numbers themselves as ground truth classes?
2. Changing Feature Units
Starting conditions
Multiply only X's first column by 10, and compare the original data, modified data, and results of column-wise standardization.
Procedure
Prepare the original X, X2 with its first column multiplied by 10, and X2 standardized column by column.
Retrain KMeans with on each dataset. Keep random_state=7 and n_init=10 unchanged.
Plot cluster assignments and centers for each data condition, and record Inertia and Silhouette by K in tables with the same format. Use the plots to judge whether scaling up the first column changed assignments and centers, and explain your evidence.
Results to retain
Cluster plots for all three data conditions and a metrics table by K.
Items to record and points to check
Data condition and K
Cluster plot and centers
Inertia
Interpretation of Silhouette and Cluster Direction
Points to check
Did you use the same K and Seed for all three data conditions?
3. Checking Other Inputs
Starting conditions
Compare the same K values on data with cluster_std=1.6.
Procedure
In make_blobs, change only cluster_std to 1.6. Keep the sample count, number of centers, and Seed unchanged.
Train KMeans for the same three K values and obtain cluster plots, Inertia, and Silhouette. Record results for each K alongside the corresponding cluster_std=.8 results.
Distinguish the fact that the data were generated with three centers from whether the scatter plot visibly shows three clearly separated groups.
Results to retain
Compare plots and metrics for the two cluster-variance conditions at the same K.
Items to record and points to check
cluster_std·K
Cluster plot
Inertia·Silhouette
Separation patterns in the two datasets
Points to check
Did you compare overlap between datasets at the same K?