# Clustering (machine learning)

> Canonical: https://skillalmanac.com/glossary/clustering | Last verified: 2026-11-25 | Index status: index-eligible

Clustering groups data according to a chosen notion of similarity or structure, usually without supplied target classes. Methods differ: some assign hard clusters, others soft memberships, and some leave points as noise.

Also called: clustering, clustering algorithms, cluster analysis, clustering in data mining, clustering ML, data clustering.

## In plain language

Clustering sorts a pile of items into groups without being told what the groups are. Imagine tipping out a box of mixed buttons and sorting them by look until piles form. A program does the same with customers, documents or images, using numbers that describe each item. It gives you piles, not names for them: a person still has to look at each group and decide what it means. The result also depends on choices such as how many groups to ask for and how similarity is measured, so two reasonable setups can give different groupings.

## Technical definition

Clustering methods identify groups or structure in data, with behavior depending on the algorithm and its assumptions. K-means minimizes within-cluster squared distances; Gaussian mixtures support probabilistic membership; density-based methods such as DBSCAN can leave points as noise. Reference class labels are not required for training, but independently available labels can support external evaluation, alongside internal measures and stability checks. A cluster is not automatically a meaningful real-world category.

## How it shows up when you use agents

Clustering turns up when you ask an agent to make sense of data nobody has labelled: support tickets, survey answers, log lines, product reviews. A typical request is "group these into themes". The agent may turn each text into an [embedding](/glossary/embedding), run [k-means](/glossary/k-means) or a similar method with scikit-learn, and print the groups with a few sample items each.

The agent's output is a starting point. The algorithm returns cluster numbers, and any theme name such as "billing problems" is a reading someone added. Ask the agent to show the settings it chose, such as the number of clusters and the distance measure, and to list several members per group so you can check them by eye.

What breaks when it is misunderstood: a reader treats clusters as discovered facts. Different settings can give different groups from the same data. Google's course lists uses such as market segmentation and anomaly detection, but it does not tell you which grouping is right for your goal.

Next action: rerun with a different cluster count or algorithm and see which groups survive. See [unsupervised learning](/glossary/unsupervised-learning).

## Common confusions

- **Clustering versus classification.** Google's crash course says that when examples are labelled, the grouping is called classification. Clustering works without labels and invents the groups.
- **Clustering versus k-means.** K-means is one algorithm. IBM lists several other families, including hierarchical and density-based methods.
- **Cluster versus category.** A cluster is a set of similar examples under a chosen measure. It becomes a category when a person names and accepts it.
- **Myth.** The algorithm finds the true number of groups. Many methods take that number as an input, so it is a choice the person makes and should test.

## Worked examples in this catalogue

### [data-analysis-eda](https://skillalmanac.com/skills/skill-almanac/data-analysis-eda)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill is a fixed exploratory-analysis procedure and CSV profiler that keeps findings descriptive, evidenced and caveated.

Why it exercises the concept: Looking for natural groups is an exploratory step, and caveated findings suit cluster output, which depends on settings. The skill does not run clustering algorithms; the catalogue has no clustering skill. Illustrative only.

### [split-leakage-check](https://skillalmanac.com/skills/skill-almanac/split-leakage-check)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill checks train, validation and test files for duplicates, shared groups, time and label leakage and prints JSON.

Why it exercises the concept: Groups of near-identical records can land on both sides of a split. This skill checks for shared groups that you define; it does not discover clusters itself. Illustrative only.

### [huggingface-datasets](https://skillalmanac.com/skills/huggingface/huggingface-datasets)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill reads Hugging Face datasets through the Dataset Viewer API: metadata, rows, search and filters.

Why it exercises the concept: Clustering needs a table of examples to group. This skill can fetch rows from a public dataset; it does not group them. Illustrative only.

## Related terms

- [Unsupervised learning](https://skillalmanac.com/glossary/unsupervised-learning.md)
- [Machine learning (ML)](https://skillalmanac.com/glossary/machine-learning.md)
- [k-means clustering](https://skillalmanac.com/glossary/k-means.md)
- [Embedding](https://skillalmanac.com/glossary/embedding.md)
- [Anomaly detection](https://skillalmanac.com/glossary/anomaly-detection.md)
- [Dimensionality reduction](https://skillalmanac.com/glossary/dimensionality-reduction.md)

## Sources

- [Clustering overview - Machine Learning crash course](https://developers.google.com/machine-learning/clustering/overview), Google for Developers (accessed 2026-11-24)
- [Clustering - scikit-learn user guide](https://scikit-learn.org/stable/modules/clustering.html), scikit-learn (accessed 2026-11-24)
- [What is clustering?](https://www.ibm.com/think/topics/clustering), IBM (accessed 2026-11-24)
- [DBSCAN: noisy samples and cluster labels](https://scikit-learn.org/stable/modules/generated/sklearn.cluster.DBSCAN.html), scikit-learn (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-25. [Glossary index](https://skillalmanac.com/glossary.md).
