← Back to all experiments
ClusteringAdvancedK-meansPCAStandardScaler
K-means Clustering + PCA
Clusters Wisconsin breast cancer data and visualizes in PCA space.
Key highlights
- Standardizes features
- Clusters into 2 groups
- Reports accuracy after label alignment
Metrics
Confusion matrixAccuracy
Outputs

Clusters visualized in PCA space
Code snapshot
Key lines that anchor the experiment workflow.
kmeans = KMeans(n_clusters=2, random_state=42, n_init=10)
y_kmeans = kmeans.predict(X_scaled)
print(confusion_matrix(y, y_kmeans))Next steps
Want to explore further? Try the full gallery or open the raw script to tweak parameters.