Overview: Unsupervised learning is a category of machine learning techniques that derive insights from unlabeled data without predefined output labels. Unlike supervised learning, which relies on input-output pairs, unsupervised learning algorithms identify hidden patterns, structures, or groupings within the data autonomously. Common tasks include clustering (grouping similar data points), dimensionality reduction (compressing data while preserving key features), and association rule learning (discovering relationships between variables). It is widely used in customer segmentation, anomaly detection, data visualization, and exploratory data analysis.

1 Introduction

1.1 Definition and Motivation

Unsupervised learning refers to a class of algorithms that operate on datasets containing only input features and no corresponding target variables. The central motivation is to discover inherent structures in the data—such as clusters, latent representations, or frequent patterns—without human-provided guidance. This is especially valuable when labeling is expensive, impractical, or impossible, or when the goal is exploratory analysis rather than prediction.

1.2 Comparison with Supervised Learning

In supervised learning, the model is trained on labeled pairs (input, output) to learn a mapping function. Unsupervised learning, by contrast, has no such feedback. Supervised methods aim to minimize prediction error on known outputs, while unsupervised methods optimize criteria such as cluster compactness, reconstruction error, or statistical independence. Unsupervised learning is often used as a precursor to supervised tasks, for example in feature learning or data preprocessing.

2 Key Tasks

2.1 Clustering

Clustering partitions data into groups (clusters) such that objects within the same cluster are more similar to each other than to those in other clusters, according to a defined distance or similarity measure.

2.1.1 Partition-based (k-means)

The k-means algorithm divides data into \(k\) fixed clusters, each represented by a centroid. It iteratively assigns points to the nearest centroid and updates centroids based on the mean of assigned points. It is simple, fast, and effective for spherical clusters, but sensitive to initialization and outliers.

2.1.2 Hierarchical

Hierarchical clustering builds a tree of clusters, either agglomerative (bottom-up, merging the most similar clusters) or divisive (top-down, recursively splitting). The result is a dendrogram that allows users to choose the number of clusters at different granularities.

2.1.3 Density-based (DBSCAN)

DBSCAN groups points that are closely packed together, marking points in low-density regions as noise. It can discover clusters of arbitrary shape and does not require specifying the number of clusters a priori. It is particularly robust to outliers.

2.2 Dimensionality Reduction

Dimensionality reduction transforms high-dimensional data into a lower-dimensional representation while preserving meaningful properties of the original data, simplifying visualization and reducing computational cost.

2.2.1 Principal Component Analysis (PCA)

PCA is a linear technique that projects data onto orthogonal axes (principal components) that capture the maximum variance. It is widely used for noise reduction, feature extraction, and data compression.

2.2.2 t-Distributed Stochastic Neighbor Embedding (t-SNE) and Uniform Manifold Approximation and Projection (UMAP)

t-SNE and UMAP are nonlinear dimensionality reduction methods designed primarily for visualization. t-SNE focuses on preserving local neighborhood structures using a probabilistic approach, while UMAP builds a graph representation of the data and optimizes a low-dimensional embedding that balances local and global structure. Both are popular for exploring high-dimensional datasets.

2.3 Association Rule Learning

Association rule learning identifies interesting relationships (rules) among variables in large databases, typically in the form "if X then Y" with measures of support and confidence.

2.3.1 Apriori Algorithm

The Apriori algorithm generates frequent itemsets by iteratively expanding itemsets and pruning those that fall below a minimum support threshold. It then derives association rules from the frequent itemsets. It is straightforward but can be computationally expensive for large datasets due to multiple database scans.

2.3.2 FP-Growth Algorithm

FP-Growth (Frequent Pattern Growth) improves upon Apriori by using a compact tree structure (FP-tree) to store the database. It mines frequent itemsets recursively without generating candidate sets, often achieving faster performance for dense datasets.

3 Common Algorithms

3.1 k-Means Clustering

3.1.1 Algorithm Steps

k-means proceeds as follows: (1) randomly initialize \(k\) centroids; (2) assign each data point to the nearest centroid (e.g., using Euclidean distance); (3) recompute centroids as the mean of all points in each cluster; (4) repeat steps 2–3 until convergence (centroids stabilize or assignments stop changing). The algorithm minimizes within-cluster sum of squares.

3.1.2 Choosing the Number of Clusters (k)

Selecting \(k\) is often done using the elbow method (plotting within-cluster variance as a function of \(k\) and looking for a bend), the silhouette score, or the gap statistic. Domain knowledge also plays a role.

3.2 Hierarchical Clustering

3.2.1 Agglomerative vs Divisive Approaches

Agglomerative hierarchical clustering starts with each point as its own cluster and merges the two most similar clusters iteratively until a single cluster remains. Divisive clustering starts with one cluster and recursively splits them. Agglomerative is more common due to lower computational complexity in practice.

3.2.2 Linkage Criteria (single, complete, average, Ward)

Linkage criteria define the distance between two clusters: single (minimum distance between any pair), complete (maximum distance), average (mean distance), and Ward (increase in variance when merging). Each yields different cluster shapes and sensitivities.

3.3 DBSCAN

3.3.1 Parameters: eps and minPts

DBSCAN requires two parameters: \(\varepsilon\) (eps), the maximum distance between two points to be considered neighbors, and minPts, the minimum number of points required to form a dense region. Points with at least minPts neighbors are core points; others are border or noise points.

3.3.2 Advantages and Limitations

Advantages include identifying arbitrary-shaped clusters, handling noise, and not requiring a predefined number of clusters. Limitations are sensitivity to the choice of eps and minPts, difficulty with varying densities, and poor performance on high-dimensional data (curse of dimensionality).

3.4 Principal Component Analysis (PCA)

3.4.1 Mathematical Foundation (eigenvectors, eigenvalues)

PCA computes the covariance matrix of the data, then solves for its eigenvectors and eigenvalues. Eigenvectors define the principal component directions, and eigenvalues indicate the amount of variance captured by each component. The data is projected onto the top \(d\) eigenvectors to reduce dimensionality.

3.4.2 Explained Variance and Component Selection

The explained variance ratio of a component is its eigenvalue divided by the sum of all eigenvalues. A common practice is to select enough components to explain a target proportion (e.g., 95%) of the total variance. A scree plot helps visualize the drop-off in variance.

3.5 Autoencoders

3.5.1 Neural Network Architecture

An autoencoder is a type of neural network that learns to compress input data into a lower-dimensional latent representation (encoder) and then reconstruct the original input (decoder). It is trained to minimize reconstruction error. The bottleneck layer captures the most salient features.

3.5.2 Applications in Anomaly Detection and Representation Learning

Autoencoders are used for anomaly detection by measuring reconstruction error—anomalies tend to have high error because they deviate from normal patterns. They also serve as building blocks for representation learning, providing features for downstream tasks.

4 Evaluation Metrics

4.1 Internal Metrics (without ground truth)

Internal metrics assess clustering quality based solely on the data and cluster assignments.

4.1.1 Silhouette Score

The silhouette score for each point compares the mean distance to points in its own cluster versus the mean distance to points in the nearest other cluster. Scores range from -1 (bad) to 1 (good), with values near 0 indicating overlapping clusters.

4.1.2 Davies-Bouldin Index

The Davies-Bouldin index measures the average similarity between each cluster and its most similar counterpart. Lower values indicate better separation and compactness.

4.1.3 Dunn Index

The Dunn index is the ratio of the minimum inter-cluster distance to the maximum intra-cluster distance. Higher values suggest well-separated, compact clusters.

4.2 External Metrics (with ground truth)

External metrics compare clustering results to a known ground truth labeling.

4.2.1 Rand Index

The Rand index computes the proportion of pairs of points that are either both in the same cluster and same class, or both in different clusters and different classes. It ranges from 0 to 1, with 1 indicating perfect agreement.

4.2.2 Adjusted Mutual Information

Adjusted Mutual Information (AMI) measures the amount of information shared between two labelings, adjusted for chance. It is useful for comparing clusterings of different numbers of clusters and is robust to random partitions.

4.3 Stability and Robustness Metrics

Stability metrics evaluate how consistently an algorithm produces similar outputs under perturbations (e.g., subsampling, different initializations). For example, the average agreement between runs using sub-samples or bootstrap replicates indicates robustness.

5 Applications

5.1 Customer Segmentation

Unsupervised clustering groups customers based on purchasing behavior, demographics, or browsing patterns, enabling targeted marketing and personalized recommendations.

5.2 Anomaly Detection

Unsupervised methods (e.g., DBSCAN, autoencoders) identify outliers in data streams, network traffic, or manufacturing processes without prior examples of anomalies.

5.3 Data Visualization and Exploration

Dimensionality reduction techniques (PCA, t-SNE, UMAP) allow high-dimensional datasets to be projected into 2D or 3D plots, helping analysts detect patterns, clusters, or outliers.

5.4 Recommendation Systems (collaborative filtering)

User-based or item-based collaborative filtering often relies on unsupervised clustering or matrix factorization (a form of dimensionality reduction) to predict user preferences.

5.5 Bioinformatics (gene expression analysis)

Clustering algorithms group genes or samples with similar expression profiles, aiding in the discovery of disease subtypes, regulatory networks, and biomarkers.

6 Challenges and Limitations

6.1 Lack of Ground Truth for Validation

Without labeled data, it is difficult to objectively assess the quality of discovered patterns. Internal metrics can be misleading, and results often require domain expertise to interpret.

6.2 Scalability and High Dimensionality

Many unsupervised algorithms (e.g., hierarchical clustering, t-SNE) have quadratic time complexity, making them impractical for very large datasets. High-dimensional spaces also suffer from the curse of dimensionality, where distances become less meaningful.

6.3 Interpretability of Learned Patterns

Clusters and latent representations may not correspond to meaningful real-world categories. Understanding why a particular grouping emerges can be challenging, especially with complex models like autoencoders.

7 Recent Advances

7.1 Deep Unsupervised Learning

7.1.1 Generative Adversarial Networks (GANs)

GANs consist of a generator and a discriminator trained adversarially without labels, enabling the generation of realistic synthetic data. They can also learn unsupervised representations through the discriminator’s internal features.

7.1.2 Variational Autoencoders (VAEs)

VAEs extend autoencoders with a probabilistic formulation, allowing generation of new samples and learning smooth latent spaces. They are widely used in representation learning and data generation.

7.2 Self-Supervised Learning

7.2.1 Contrastive Learning Methods (SimCLR, MoCo)

Self-supervised learning creates pseudo-labels from the data itself (e.g., by distorting images). Contrastive methods like SimCLR and MoCo learn embeddings that pull together augmented views of the same sample while pushing apart views of different samples, achieving strong performance in vision tasks without manual labels.

7.3 Graph-based Clustering and Graph Neural Networks

Modern approaches apply graph neural networks (GNNs) to learn node embeddings that preserve graph structure, then cluster or visualize those embeddings. Graph-based clustering methods (e.g., spectral clustering on learned graphs) can handle non-Euclidean data and have shown promise in social network analysis and molecular biology.