Centroid
A centroid is a central point representing a geometric figure or set of points, commonly calculated as the coordinate-wise mean, with weights when applicable.
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.
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.
Related concepts
- K-means clusteringused by · K-means clustering partitions data into a specified number of groups by assigning observations to representative centers and iteratively updating those centers to reduce within-group distances.
- meanuses · A mean is a measure of central tendency, calculated as the arithmetic average of values or, for a random variable, as the probability-weighted average of its possible values.
- k-means++ initializationused by · K-means++ initialization is a procedure that selects initial centroids using probability proportional to squared distance from previously selected centroids.
- getBoundingClientRectproduced by · getBoundingClientRect is a DOM method that returns an element's size and position relative to the viewport.
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.






