Unsupervised Learning

Different Types of Unsupervised Machine Learning Algorithms

Learn the main types of unsupervised machine learning algorithms, including clustering, dimensionality reduction, association rules and anomaly detection.

On this page
  1. What makes an algorithm unsupervised
  2. Clustering algorithms
  3. Dimensionality reduction
  4. Association rule learning
  5. Anomaly detection
  6. Neural network approaches
  7. Choosing an unsupervised method
  8. Judging the results
  9. Common mistakes
  10. Summary

Unsupervised machine learning algorithms learn from data that has no labels. Nobody has told the algorithm the right answer for each example, so its job is to find structure on its own. That structure might be groups of similar items, a smaller set of useful features, rare cases that don’t fit the rest, or items that tend to occur together. The main families are clustering, dimensionality reduction, association rule learning and anomaly detection. Neural network methods, such as autoencoders and self-organizing maps, add more options. The boundaries between these families are not sharp, and one technique often shows up in more than one of them.

Most introductions answer “What are the main 3 types of ML models?” with supervised, unsupervised and reinforcement learning. This article focuses on the unsupervised branch.

What makes an algorithm unsupervised

In supervised learning, every training example comes with a known target, such as a spam or not-spam tag on an email. The algorithm learns a mapping from inputs to those targets. Unsupervised learning works from the inputs alone. Labels can be slow or costly to collect, and many datasets come without them. Unsupervised methods are useful when labels are missing or when you don’t yet know what categories exist.

The labeled side of that contrast is covered in supervised learning types with examples, which makes a useful companion read. This article stays with the unlabeled side.

The missing answer key also makes results harder to judge. A clustering result is good if its groups are useful for the task, and you can’t always check that against correct answers. The checks are covered in a section below.

Clustering algorithms

Clustering groups data points so that points in the same group are more similar to each other than to points in other groups. Similarity is usually a distance measure computed on the features. These are the methods you will meet most often:

  • K-means. You choose the number of clusters, k. The algorithm places k centers, assigns each point to its nearest center, moves each center to the average of its assigned points, and repeats until the assignments settle. It is fast and easy to explain. It assumes clusters that are roughly round and similar in size, and it needs k set in advance. The result can depend on the starting centers, so implementations usually run several starts and keep the best.
  • Hierarchical clustering. This method builds a tree of nested groups, often drawn as a dendrogram. In the common bottom-up (agglomerative) form, each point starts alone and the closest groups merge step by step. Cutting the tree at a chosen height gives a set of clusters, so you don’t have to fix k in advance. It can be slow and memory-hungry on very large datasets.
  • DBSCAN. This density-based method groups points that sit in crowded regions and labels isolated points as noise. It can find irregular shapes and doesn’t need k, but you must set a neighborhood radius and a minimum number of neighbors. When clusters have very different densities, those two settings are hard to choose well.
  • Gaussian mixture models. These assume the data comes from a mixture of several bell-shaped distributions and fit them with an iterative method called expectation-maximization. Instead of a hard assignment, each point gets a probability of belonging to each cluster, which helps when groups overlap.

In some fields, clustering is also called unsupervised classification. Readers who ask “What is unsupervised classification?” are usually asking about this same idea.

Dimensionality reduction

Dimensionality reduction shrinks many features into fewer ones while keeping as much useful information as possible. It can make data easier to plot, speed up later steps and reduce noise. Three common tools are:

  • Principal component analysis (PCA). PCA finds new axes, called principal components, that are perpendicular to each other and ordered by how much variation they capture. It is linear, so it can’t unfold curved structure, but it is fast and its output is relatively easy to interpret.
  • t-SNE. This nonlinear method places points in two or three dimensions so that points close together in the original data tend to stay close. It is popular for plots of complex data. Distances between separated groups in the plot are not reliable, and results depend on settings such as perplexity.
  • UMAP. Another nonlinear method used for visualization and general-purpose embedding. It is often faster than t-SNE on large datasets and is often reported to keep more of the overall layout, though it still needs careful settings.

Scale matters for all of these. If one feature is measured in thousands and another in fractions, the large one will dominate distances. Standardizing features before clustering or PCA is a common, low-risk step.

Association rule learning

Association rule learning looks for items that often appear together. The classic example is market basket analysis. If many shoppers who buy bread also buy butter, a store might decide to place those items near each other. Rules are judged with three measures:

  • Support is how often a set of items appears across all transactions.
  • Confidence is how often the second item appears when the first one does.
  • Lift compares how often the items appear together with how often they would appear together by chance. A lift above 1 suggests a positive association.

Apriori is the best-known algorithm. It builds candidate item sets one size at a time and prunes any candidate that contains an infrequent smaller set. FP-Growth finds the same frequent item sets using a tree structure and avoids generating many candidates, which often makes it faster on large data.

Anomaly detection

Anomaly detection looks for rare or unusual points that differ from most of the data, such as a sudden spike in network traffic or a faulty sensor reading. Many methods learn what normal looks like and flag what doesn’t fit. Common choices include:

  • Isolation forest isolates points with random splits. Unusual points tend to be isolated after fewer splits.
  • Local outlier factor compares the density around a point with the density around its neighbors. A point that is much less dense than its neighbors gets flagged.
  • One-class SVM learns a boundary around normal data and treats points outside it as anomalies.

Anomaly detection is often grouped with unsupervised learning. Real projects sometimes use a small number of labeled anomalies to tune or check a method, though.

Neural network approaches

Neural networks can learn without labels too.

  • Autoencoders are trained to reconstruct their input after squeezing it through a narrow middle layer. That middle layer becomes a learned, lower-dimensional code. Autoencoders can be thought of as a nonlinear relative of PCA, and they are used for compression, denoising and anomaly detection.
  • Self-organizing maps map high-dimensional data onto a grid of nodes so that similar inputs land on nearby nodes. Teuvo Kohonen introduced them, and they are often used for visualization and exploration.
  • Generative models learn the pattern of the data well enough to produce new examples. Variational autoencoders and generative adversarial networks (GANs) are the best-known types. GANs are often grouped with unsupervised learning because their training data has no labels, although their setup includes parts that look supervised.
  • Self-supervised learning builds training targets from the data itself, such as predicting a hidden word from the words around it. Large language models are pretrained this way, which leads many people to ask “Is LLM supervised or unsupervised learning?” The answer depends on the training stage.

Choosing an unsupervised method

Start from the goal rather than the algorithm:

  • Group similar items with no known categories: K-means for roughly round groups of similar size, DBSCAN when clusters are irregular or noise is present, and hierarchical clustering when you want a tree view.
  • Reduce features or plot high-dimensional data: PCA as a fast, linear baseline, and t-SNE or UMAP for two-dimensional plots.
  • Find items that co-occur: Apriori or FP-Growth.
  • Spot unusual cases: isolation forest or local outlier factor.
  • Learn compact representations or generate new samples: autoencoders, variational autoencoders or GANs.

Real projects often combine methods, such as reducing dimensions with PCA and then clustering the reduced data.

Judging the results

Without labels, you can’t measure accuracy directly. These checks help:

  • Internal scores. The silhouette score compares how close each point is to its own group with how close it is to the nearest other group. Values closer to 1 suggest tighter, better-separated groups. The Davies-Bouldin index works the other way, where lower is better.
  • Stability. Re-run the method with different random starts, or on a random subset of the data. If the groups change a lot, be cautious about them.
  • Domain review. Ask someone who knows the data whether the groups and their profiles make sense.
  • Downstream tests. If the output feeds another task, check whether it actually helps that task.

Common mistakes

  • Skipping feature scaling, so one large-valued feature drives the results.
  • Treating group numbers such as 0, 1 and 2 as meaningful labels. They are arbitrary IDs.
  • Assuming the groups match real categories because the algorithm produced them.
  • Choosing the number of clusters by picking whichever result looks nicest, without checking stability.

Summary

Unsupervised algorithms find structure in unlabeled data. Clustering groups similar items, dimensionality reduction compresses or visualizes features, association rules find items that appear together, anomaly detection flags unusual points, and neural methods such as autoencoders learn compact representations. Match the family to your goal, prepare the data carefully, and check the results with more than one method.

Keep exploring

Guides from other topics

All topics →