Centroid
A point representing the center of a set of points or a region, commonly calculated as the coordinate-wise mean or, for weighted points, the weighted mean.
Advanced Algorithms and Data Structures
A center of mass is the point representing the coordinate-weighted average location of a body or collection of points.
- How it is used
- Locates spherical SS-tree envelopes and represents clusters for nearest-centroid assignment in k-means.
- How deep it goes
- Defines the center of mass and implements coordinate-wise means, node-envelope updates, and iterative recentering; defers smallest-enclosing-sphere approximation details.
- Examples
- Illustrates nearest-centroid insertion, a three-centroid k-means iteration, and contrasting centroid-centered and minimum covering spheres.
- What you can do after
- Build it from scratch to update SS-tree envelopes or recenter k-means clusters, while recognizing overlap and outlier trade-offs.
Read how Advanced Algorithms and Data Structures explains centroid →
D3.js in Action, Third Edition
A centroid is the geometric center of a shape or region.
- How it is used
- Positions labels at the visual center of arcs in pie and donut charts.
- How deep it goes
- Explains centroid calculation, returned coordinates, and SVG alignment, but defers general shape-centroid mathematics.
- Examples
- Demonstrates a 35% precipitation label and percentage labels placed on multiple donut-chart arcs.
- What you can do after
- Apply it via D3’s arc generator to calculate and align labels inside pie or donut-chart arcs.
Data Without Labels
A centroid is the arithmetic mean position of a set of points and represents a cluster in centroid-based clustering.
- How it is used
- Represents clusters so centroid-based clustering can compare points with groups by distance.
- How deep it goes
- Works through iterative assignment and mean-based center updates, then retrieves fitted centers; defers further centroid mathematics to an appendix.
- Examples
- Uses an illustrated three-center iteration and a standardized vehicle dataset clustered and profiled with Python.
- What you can do after
- Apply it via scikit-learn to retrieve cluster centers and use them to profile a fitted vehicle-clustering result.
Outlier Detection in Python
A cluster center is a representative location or point associated with a cluster and used to measure observations' proximity to that cluster.
- How it is used
- Uses cluster centers as reference locations for judging how unusual observations are within clustered data.
- How deep it goes
- Explains center-relative and cluster-relative distance scoring, including an optional size adjustment, without deriving how centers are estimated.
- Examples
- Illustrates scoring with single- and multiple-cluster results and contrasts it with DBSCAN flags for unassigned points.
- What you can do after
- Apply it via Gaussian mixture clustering and Mahalanobis distance to compare points with their own cluster’s typical distance.
Build AI Drug Discovery Pipelines
A centroid is the arithmetic mean position of the points assigned to a cluster.
- How it is used
- Supports selecting representative compounds from clusters during molecular-library diversity analysis.
- How deep it goes
- Defines the mean position and demonstrates its NumPy computation, stopping short of a broader mathematical treatment.
- Examples
- Uses fingerprint arrays, NumPy means, SciPy distances, and sampled molecules as concrete implementation artifacts.
- What you can do after
- Apply it via NumPy and SciPy to select molecules closest to each cluster center.
Read how Build AI Drug Discovery Pipelines explains centroid →
Statistics Slam Dunk
A centroid is the central position of a set of points, commonly calculated as the coordinate-wise mean.
- How it is used
- Uses centroids to assign data points to nearby clusters and recalculate cluster centers during K-means.
- How deep it goes
- Explains centroids through iterative assignment, mean recalculation, convergence, and within-cluster variation.
- Examples
- Uses NBA team payrolls and regular-season wins to calculate four cluster centroids and assign every team.
- What you can do after
- Apply it via base R's kmeans() and interpret cluster means as centroids.
Classic Computer Science Problems in Swift: Essential techniques for practicing programmers
A centroid is a representative center of a cluster, typically computed as the mean position of its member points.
- How it is used
- Uses centroids to partition normalized data points into a user-selected number of clusters.
- How deep it goes
- Explains centroid assignment, coordinate-wise mean updates, convergence, initialization, and practical limitations.
- Examples
- Demonstrates centroids with Swift Point3D data and governor longitude-age clusters.
- What you can do after
- Build it from scratch with a Swift KMeans type that initializes, updates, and tests centroid convergence.
Cyber Threat Hunting
A centroid is the arithmetic mean of the data points assigned to a cluster and represents that cluster's center.
- How it is used
- Uses centroids to assign data points to clusters and identify potentially interesting smaller groups in traffic data.
- How deep it goes
- Explains centroid calculation, distance assignment, iteration, scaling, and outlier sensitivity without deriving the algorithm’s implementation.
- Examples
- Uses a 14-feature traffic table, four clusters, two-dimensional plots, histograms, and cluster-size counts.
- What you can do after
- Apply it via scikit-learn to fit k-means, label rows, visualize clusters, and compare cluster sizes.
Retrieval Augmented Generation, The Foundational Ideas
A cluster centroid is the representative mean vector of the items assigned to a cluster.
- How it is used
- Uses centroids to partition vector spaces and reduce approximate-nearest-neighbor search from exhaustive comparison to cluster-focused search.
- How deep it goes
- Explains k-means initialization, assignment, mean recalculation, convergence, and query routing, while deferring clustering and compression details.
- Examples
- Uses random initialization, nearest-centroid assignment, mean recalculation, and FAISS's two-stage query search as examples.
- What you can do after
- Apply it via FAISS to route queries into clusters before performing focused nearest-neighbor searches.
Read how Retrieval Augmented Generation, The Foundational Ideas explains centroid →
Grokking Bayes
A cluster center is a parameter representing the location of a component in a mixture model.
- How it is used
- Uses cluster centers to represent the locations of mixture components and distinguish behaviors in observed data.
- How deep it goes
- Explains center priors, dimensionality, label switching, sampling symptoms, and ordered transformations, but not centroid computation from raw points.
- Examples
- Uses standardized Old Faithful waiting times, short- and long-waiting-time clusters, posterior traces, and PyMC model declarations.
- What you can do after
- Operate/configure PyMC mixture models by assigning center priors and ordering centers to stabilize cluster identities.
Also covered in
- The Well-Grounded Data Analyst
- Privacy-Preserving Machine Learning
- AI-Powered Search
- Human-in-the-Loop Machine Learning: Active learning and annotation for human-centered AI
- Math for Web Design
- LLM Customization and Fine-TuningIn early access (MEAP)
- Data Analysis with LLMs
What to know first
- clusteringClustering is the process of grouping data items so that items within a group are more similar to one another than to items in other groups.
- Euclidean distanceEuclidean distance is the straight-line distance between two points, calculated as the square root of the sum of squared differences between corresponding coordinates.
- silhouette coefficientThe silhouette coefficient measures how well a sample fits its assigned cluster compared with the nearest alternative cluster, typically ranging from -1 to 1.
- inner productAn inner product is a scalar-valued operation on two vectors that generalizes the dot product, which for real coordinate vectors is the sum of products of corresponding components.
Related concepts
- K-means clusteringused by · K-means clustering is an algorithm that partitions data into a specified number of clusters by iteratively assigning observations to the nearest centroid and updating each centroid to the mean of its assigned observations.
- meanuses · The mean is a measure of central location equal to the arithmetic average of numerical observations, or the probability-weighted average of a random variable’s possible values.
- Gaussian prioruses · A Gaussian prior is a prior probability distribution over an unknown quantity that follows a Gaussian, or normal, distribution.
- arc generatorproduced by · An arc generator is a D3 shape generator that produces SVG path data for circular or annular arcs from radius and angle parameters.
Questions about centroid
What is centroid?
A point representing the center of a set of points or a region, commonly calculated as the coordinate-wise mean or, for weighted points, the weighted mean.
Which Manning books explain centroid?
Advanced Algorithms and Data Structures, D3.js in Action, Third Edition, Data Without Labels, Outlier Detection in Python, Build AI Drug Discovery Pipelines, Statistics Slam Dunk, Classic Computer Science Problems in Swift: Essential techniques for practicing programmers, Cyber Threat Hunting and 2 more.
What should I know before learning centroid?
Manning books that teach centroid usually introduce clustering, Euclidean distance, silhouette coefficient and inner product first.
What kinds of centroid are there?
Kinds of centroid include local context centroid.
What is centroid also called?
Centroid is also called cluster center.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.









