Cluster Iris Flowers
Guided clustering project · 20 steps · K-means clustering
About
Learn unsupervised learning by grouping Iris flowers and checking how the discovered clusters compare to known species.
Data
Loaded from scikit-learn via load_iris. Four flower measurements with three species labels for reference.
Task
Complete TODOs in order, run KMeans, pick a good k with elbow and silhouette, then evaluate cluster quality with ARI.
Sign in to run cells and save progress. Log in or sign up.
Step 1: Imports
Step 2: Load dataset
Step 3: Build DataFrame
Step 4: Add species names
Step 5: Shape and class counts
Step 6: Preview rows
Step 7: Quick summary stats
Step 8: 2D scatter by true species
Step 9: Prepare feature matrix
Step 10: Scale features
Step 11: KMeans with k=3
Step 12: Cluster sizes
Step 13: Compare cluster vs species
Step 14: Clusters in petal space
Step 15: Inertia for k=1..8
Step 16: Elbow plot
Step 17: Silhouette for k=2..8
Step 18: Silhouette plot
Step 19: Evaluate clustering quality
Step 20: Inspect cluster centers