K-means clustering

Multivariate analysis · Method and input reference

Numeric Euclidean clustering; seed 2026, 20 starts. Assumes useful distance scales and roughly compact groups. Sensitive to outliers. At most 1,000 complete rows. Standardization uses population SD. Assignments, original-unit means and silhouette are exploratory summaries, not p-values or proof of true groups. Synthetic example: 90 simulated observations from three overlapping numeric groups.

Open calculator · Compare methods in the decision matrix

When to consider it

  • Partition numeric observations into a prespecified number of compact Euclidean clusters.

Assumptions and scope

  • Review scaling, outliers, cluster shape and stability. Sample size alone does not justify k-means.

Fixed seed; standardization optional. Clustering is exploratory, not a hypothesis test.

Required inputs

  • Observations × numeric features — Numeric observations; preserve the row and column structure described above.
  • Number of clusters — Enter the method parameter described above.
  • Standardize features — Choose Yes, No.

Review missing values and data coding before running. Sample inputs are synthetic teaching examples.

Implementation

Numeric Euclidean clustering; seed 2026, 20 starts. Assumes useful distance scales and roughly compact groups. Sensitive to outliers. At most 1,000 complete rows. Standardization uses population SD. Assignments, original-unit means and silhouette are exploratory summaries, not p-values or proof of true groups. Synthetic example: 90 simulated observations from three overlapping numeric groups.

  • scikit-learn 1.7.2: sklearn.cluster.KMeans, sklearn.preprocessing.StandardScaler, sklearn.metrics.silhouette_score

These are pinned library versions; saved results record the versions actually used at runtime.

Library references