Centroid

noun

say it: “SEN-troyd” /ˈsɛnˌtrɔɪd/

The center point of a group of points, found by averaging their positions in each direction.

What is a centroid?

A centroid is the center of a cluster: the average of its examples, feature by feature. k-means puts each example with its nearest centroid, then moves each centroid to the average of its examples. scikit-learn's KMeans keeps them in cluster_centers_.

import numpy as np
cluster = np.array([[2, 5], [4, 7], [3, 9]])   # visits a week, dollars a visit
print(cluster.mean(axis=0))   # [3. 7.]: the centroid

In a sentence

  • “Each round of k-means moved every centroid to the average of its group.”
  • “The commuters' centroid sat at 5 visits a week and $4 a visit.”

Level: Journeyman · More AI Basics terms at this level

Updated