Clustering
Clustering 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.
Data Without Labels
Clustering is an unsupervised technique that groups data points so that members of the same group are more similar to one another than to members of other groups.
- How it is used
- Groups unlabeled observations to discover patterns and create actionable customer or market segments.
- How deep it goes
- Works through method choices, distance measures, evaluation metrics, data preparation, and Python applications, with some mathematical details deferred to an appendix.
- Examples
- Uses retail customer segmentation and a Python TF-IDF example that groups football and travel sentences.
- What you can do after
- Apply it via Python clustering workflows, then assess whether the resulting groups are distinct and useful for a business decision.
Build AI Drug Discovery Pipelines
Clustering is an unsupervised learning technique that partitions data instances into groups of similar instances.
- How it is used
- Uses clustering to select representative compounds for diverse libraries without requiring labels.
- How deep it goes
- Explains representation, distance, hierarchical clustering, sampling, and evaluation with implementations of agglomerative and Taylor-Butina clustering.
- Examples
- Demonstrates fingerprint-based compound selection, cluster sampling, and library diversity and redundancy checks.
- What you can do after
- Apply it via RDKit and scikit-learn to group molecular fingerprints and select compounds from clusters.
Read how Build AI Drug Discovery Pipelines explains clustering →
The Well-Grounded Data Analyst
Clustering is the process of grouping observations so that members of the same group are more similar to one another than to members of other groups.
- How it is used
- Deploys clustering to create customer or product segments that support different recommendations, offers, or actions.
- How deep it goes
- Explains exploratory checks, scaling, algorithm selection, assignment, cluster-count comparison, and persona-based evaluation.
- Examples
- Uses mobile browsing behavior, scaled user features, inertia comparisons, cluster assignments, centers, and named user personas.
- What you can do after
- Apply it via Python, pandas, matplotlib, and scikit-learn to produce and interpret actionable user segments.
Read how The Well-Grounded Data Analyst explains clustering →
Outlier Detection in Python
An unsupervised learning technique that divides items into groups whose members are more similar to one another than to members of other groups.
- How it is used
- Uses groups of similar unlabeled items as comparison sets for finding unusual records.
- How deep it goes
- Develops global and local outlier interpretations, limitations, and several scoring workflows rather than a single universal procedure.
- Examples
- Uses animal images, financial transactions, wall-robot-navigation measurements, and 20 Newsgroups messages.
- What you can do after
- Apply it via scikit-learn DBSCAN to flag unassigned records and inspect their position against clusters.
Advanced Algorithms and Data Structures
A clustering algorithm groups unlabeled data points into subsets according to relationships or similarities among them.
- How it is used
- Groups unlabeled data for customer segmentation, outlier detection, and preprocessing.
- How deep it goes
- Works through k-means initialization, assignment, and recentering, and contrasts density-based methods and evaluation choices.
- Examples
- Uses 2-D point diagrams and income-versus-spending customer groups compared at five, six, and seven centroids.
- What you can do after
- Build it from scratch with k-means pseudocode and evaluate parameter choices using the elbow method.
Read how Advanced Algorithms and Data Structures explains clustering →
Human-in-the-Loop Machine Learning: Active learning and annotation for human-centered AI
A procedure that groups data items according to similarities or patterns in their representations.
- How it is used
- Supports diverse selection of unlabeled items for human annotation before supervised training.
- How deep it goes
- Explains sampling and representation tradeoffs, compares alternatives at a high level, and defers PCA implementation.
- Examples
- Uses news headlines, image representations, and sentiment-grouped social media messages to illustrate grouping choices.
- What you can do after
- Apply clustering to select diverse items for human labeling and combine it with representative sampling.
Grokking Bayes
- How it is used
- Groups observations by implicit membership to analyze waiting times, customer behavior, gene expression, and household consumption.
- How deep it goes
- Works through probabilistic membership and stick-breaking weights, then examines predictive fit, label switching, and practical truncation.
- Examples
- Uses short and long Old Faithful waiting times, a ten-component fit, and customer segmentation by recency, frequency, and monetary behavior.
- What you can do after
- Apply it via PyMC to infer cluster weights and membership probabilities, then inspect predictive fit and label switching.
Grokking Machine Learning
An algorithm that partitions data points into groups based on similarity.
- How it is used
- Groups unlabeled data into similar clusters to extract information or make the data easier to handle.
- How deep it goes
- Defines clustering and illustrates feature-based groupings, without detailing a clustering algorithm or evaluation method.
- Examples
- Illustrates grouping houses by features, emails by size and recipients, and images by animal similarity.
- What you can do after
- Apply clustering to group unlabeled houses, emails, or images by selected similarities.
Effective Data Analysis
A clustering model assigns data points to groups according to similarity in selected variables without a designated outcome.
- How it is used
- Uses clustering to explore open-ended questions about underlying groups and patterns in data.
- How deep it goes
- Defines similarity-based grouping and user interpretation, but stops short of explaining algorithm mechanics.
- Examples
- Uses customer behavior, neighborhood characteristics, app engagement, and student performance as grouping examples.
- What you can do after
- Evaluate/understand it by interpreting assigned groups and judging whether they offer value.
The Art of AI Product Development
Clustering is an unsupervised learning technique that groups data points according to similarities in their characteristics.
- How it is used
- Uses clustering to structure poorly understood data and discover user segments for personalization, marketing, and product decisions.
- How deep it goes
- Explains three clustering methods, evaluation metrics, and iterative feature and cluster-count optimization without implementation code or mathematical derivations.
- Examples
- Uses e-commerce recommendation engagement, purchases, profile edits, and a scraping bot to illustrate behavioral segments and anomalies.
- What you can do after
- Evaluate and understand clustering options, then use behavioral segments to guide product and marketing actions.
Read how The Art of AI Product Development explains clustering →
Statistics Slam Dunk
Customer segmentation is the division of customers into groups based on shared purchasing, demographic, or other attributes.
- How it is used
- Segments customers, teams, or other objects into similarity-based groups for analysis and tailored strategies.
- How deep it goes
- Explains K-means iteration, centroid assignment, convergence, distance, and cluster-count selection, alongside hierarchical clustering.
- Examples
- Uses customer demographics and purchases, NBA payrolls and wins, and draft-pick career win shares.
- What you can do after
- Apply it via R to segment observations, compare cluster counts, and visualize hierarchical or K-means results.
The AI Pocket Book
An unsupervised learning method that groups similar data points into clusters.
- How it is used
- Uses unlabeled data to explore patterns and group similar points.
- How deep it goes
- Defines grouping and illustrates ambiguity, but does not explain clustering algorithms or internal mechanics.
- Examples
- Uses patient medical records, alternative cluster counts, and the knee or elbow curve heuristic.
- What you can do after
- Apply clustering to explore data while judging its groupings as non-unique and difficult to validate.
First-Party Data Activation
The practice of dividing a customer or user population into groups with shared characteristics or behaviors for differentiated marketing.
- How it is used
- Uses audience segmentation to target first-party-data campaigns and tailor sales nurturing.
- How deep it goes
- Explains segmentation choices and campaign measurement at a practical level, while deferring technical how-to instructions.
- Examples
- Illustrates segmentation with ticket buyers scored for season-ticket upgrades and notified sales representatives offering VIP tours.
- What you can do after
- Apply segmentation via GrowthLoop to select audiences and channels, adjust data updates, and test campaigns.
Optimization Algorithms: AI techniques for design, planning, and control problems
The task of partitioning objects into groups whose members are more similar to one another than to members of other groups.
- How it is used
- Frames clustering as a combinatorial problem for grouping objects by similarity or dissimilarity.
- How deep it goes
- Defines unordered grouping and relates partition counts to Stirling numbers, without detailing a clustering algorithm.
- Examples
- Uses smart shopping or luggage carts gathering near designated assembly points as a practical example.
- What you can do after
- Understand clustering as grouping objects into unordered sets according to similarity or dissimilarity.
Classic Computer Science Problems in Swift: Essential techniques for practicing programmers
Clustering is a computational technique that divides data points into groups whose members are related according to some measure or interpretation.
- How it is used
- Uses data grouping to reveal structure when dataset parts are unknown.
- How deep it goes
- Defines clustering and details k-means assignment, centroid updates, normalization, initialization, and stopping; leaves choosing k to experimentation.
- Examples
- Uses grocery-shopping patterns, governor age and longitude, and applications in patrol, biology, image recognition, and voter targeting.
- What you can do after
- Apply k-means in Swift to group data points, then inspect whether the resulting clusters are meaningful.
AI-Powered Search
Clustering is an unsupervised learning technique that groups items according to similarity.
- How it is used
- Creates data-driven product categories from embedding similarity to constrain personalization to query-related interests.
- How deep it goes
- Implements KMeans over product embeddings, then checks cluster coherence through top terms and a PCA visualization.
- Examples
- Groups nearly 50,000 products into 100 clusters, revealing patterns in kitchen appliances, music, video, and storage.
- What you can do after
- Build it from scratch by clustering product embeddings, inspecting cluster terms, and using categories as personalization guardrails.
Grokking Machine Learning, Second Edition
An unsupervised learning technique that groups unlabeled data points into clusters based on similarity.
- How it is used
- Groups unlabeled data to extract information, organize similar items, or simplify data before supervised learning.
- How deep it goes
- Defines clustering and illustrates it with housing, image, and email examples, but does not detail particular clustering algorithms.
- Examples
- Uses unlabeled dog and cat images, houses grouped by features, and emails grouped by size and recipient count.
- What you can do after
- Apply clustering to organize unlabeled images, housing records, or emails by observable similarities.
Read how Grokking Machine Learning, Second Edition explains clustering →
How Large Language Models Work
A technique that groups data items according to similarities among their features or representations.
- How it is used
- Groups embedding representations to organize similar texts, route cases, and expose patterns for practical decisions.
- How deep it goes
- Explains embeddings, grouping, named algorithms, and a support workflow, but does not provide algorithmic mechanics or parameter guidance.
- Examples
- Uses market-segment analysis, plotted embedding texts, and grouped customer problems as concrete examples.
- What you can do after
- Apply clustering to embedding-based workflows that organize similar cases and route them toward analysts or vetted solutions.
Read how How Large Language Models Work explains clustering →
Data Analysis with LLMs
Text clustering is the unsupervised grouping of text documents according to the similarity of their represented features.
- How it is used
- Groups semantically similar documents when categories are not known in advance, such as emails about changing workplace topics.
- How deep it goes
- Explains semantic embeddings and an end-to-end CSV workflow, while noting that choosing the right number of clusters can be difficult.
- Examples
- Separates poems from emails in a mixed dataset using two clusters and outputs a cluster ID for each row.
- What you can do after
- Build it from scratch by embedding CSV text with OpenAI and clustering vectors with scikit-learn K-means.
Timeless Algorithms, The Foundational Ideas
Clustering is an unsupervised modeling technique that groups observations according to similarity without predefined labels.
- How it is used
- Uses unlabeled observations to reveal groupings that can support subsequent analysis and decision-making.
- How deep it goes
- Defines k-means and hierarchical clustering, contrasts their construction, and introduces entropy as an alternative evaluation perspective.
- Examples
- Illustrates customer purchasing segments, groups of clinically similar patients, and social-network communities.
- What you can do after
- Understand how clustering groups unlabeled observations and how entropy shifts evaluation toward uncertainty reduction.
Read how Timeless Algorithms, The Foundational Ideas explains clustering →
Inside AI
Clustering is the computational task of grouping data items according to similarities without requiring predefined categories.
- How it is used
- Groups unlabeled data by similarity to reveal useful categories and patterns.
- How deep it goes
- Defines the grouping task and gives applications without detailing algorithms or implementation.
- Examples
- Groups retail customers by purchasing behavior and cities by population size.
- What you can do after
- Understand how similarity-based groups can reveal customer segments and patterns in city data.
Data-Driven Cybersecurity
Clustering is a data-analysis technique that groups observations according to similarity without requiring predefined labels.
- How it is used
- Uses similarity-based grouping to analyze cybersecurity data and surface behavior that may warrant investigation.
- How deep it goes
- Works through K-Means device grouping and visualization, and also identifies DBSCAN as an approach for spotting outliers.
- Examples
- Uses device login features for K-Means and network communication patterns for DBSCAN threat detection.
- What you can do after
- Diagnose potentially anomalous device behavior by inspecting cluster assignments and outliers.
Learn Docker in a Month of Lunches, Second Edition
A cluster is a group of machines managed together as a single computing system.
- How it is used
- Groups machines under Kubernetes so applications can be managed against the cluster as a whole.
- How deep it goes
- Defines cluster membership and whole-cluster operation, while leaving provisioning mostly to a platform.
- Examples
- Names Azure AKS provisioning, Docker Desktop, and Docker or containerd runtimes.
- What you can do after
- Operate a cluster by provisioning it through a platform and using kubectl to work with it as a whole.
Read how Learn Docker in a Month of Lunches, Second Edition explains clustering →
Financial AI in Practice
Clustering is the grouping of observations according to similarities in their measured attributes.
- How it is used
- Uses K-means as a middle ground for setting credit-scoring bins from similar numerical profiles.
- How deep it goes
- Defines clustering's role in binning but does not detail K-means implementation or parameter choices.
- Examples
- Illustrates K-means grouping similar numerical profiles and income quartiles as distribution-based bins.
- What you can do after
- Understand clustering's role as a target-independent option for creating credit-risk feature bins.
Also covered in
- Elixir in Action, Third Edition
- Cyber Threat Hunting
- Graph Algorithms for Data Science
- Privacy-Preserving Machine Learning
- Architecting an Apache Iceberg Lakehouse
- Math and Architectures of Deep Learning
- Retrieval Augmented Generation, The Foundational IdeasIn early access (MEAP)
- Spring in Action, Sixth Edition
- Grokking AI Algorithms, Second Edition
- Knowledge Graphs and LLMs in Action
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- supervised learningSupervised learning is a machine-learning approach that learns predictive relationships from examples paired with known target outputs or labels.
- centroidA 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.
- K-means clusteringK-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.
Related concepts
- K-means clusteringproduced 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.
- ATLAScontrasts with · An active transfer learning method for adaptive sampling that combines uncertainty and diversity considerations.
- k-means++ initializationincludes · K-means++ initialization is a procedure that selects initial centroids using probability proportional to squared distance from previously selected centroids.
- agglomerative clusteringincludes · Agglomerative clustering is a bottom-up hierarchical clustering method that starts with individual items as separate clusters and repeatedly merges clusters according to a linkage criterion.
- prototype-based clusteringincludes · Prototype-based clustering represents each cluster with a prototype and assigns instances according to their proximity to those prototypes.
Questions about clustering
What is clustering?
Clustering 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.
Which Manning books explain clustering?
Data Without Labels, Build AI Drug Discovery Pipelines, The Well-Grounded Data Analyst, Outlier Detection in Python, Advanced Algorithms and Data Structures, Human-in-the-Loop Machine Learning: Active learning and annotation for human-centered AI, Grokking Bayes, Grokking Machine Learning and 16 more.
What should I know before learning clustering?
Manning books that teach clustering usually introduce language model, supervised learning, centroid and K-means clustering first.
What is the difference between clustering and ATLAS?
Clustering 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. An active transfer learning method for adaptive sampling that combines uncertainty and diversity considerations.
What kinds of clustering are there?
Kinds of clustering include k-means++ initialization, agglomerative clustering, divisive hierarchical clustering and prototype-based clustering.
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.























