Study guide

2.3 Unsupervised Learning: Clustering & Dimensionality Reduction

Oracle Cloud Infrastructure OCI

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Exam Overview & Artificial Intelligence Foundations

1.1 OCI AI Foundations Associate (1Z0-1122-26) Overview & Exam Logistics 1.2 Artificial Intelligence Definitions, Evolution & Industrial Applications 1.3 Data Foundations: Structured vs Unstructured Data & The AI/ML/DL Hierarchy

2 Chapter 2: Machine Learning Foundations & Core Paradigms

2.1 Machine Learning Principles & The End-to-End ML Lifecycle 2.2 Supervised Learning: Classification, Regression & Core Algorithms 2.3 Unsupervised Learning: Clustering & Dimensionality Reduction 2.4 Reinforcement Learning: Agents, Environments & Reward Optimization

3 Chapter 3: Deep Learning Foundations & Neural Network Architectures

3.1 Deep Neural Networks, Perceptrons & Training Dynamics 3.2 Convolutional Neural Networks (CNNs) & Computer Vision 3.3 Sequence Models: RNNs, LSTMs & Temporal Processing

4 Chapter 4: Generative AI, Large Language Models & Prompt Engineering

4.1 Generative AI Concepts: Discriminative vs Generative Paradigms 4.2 Large Language Models, Tokenization & Vector Embeddings 4.3 The Transformer Architecture & Self-Attention Mechanisms 4.4 Prompt Engineering Techniques & Instruction Tuning

5 Chapter 5: OCI AI Portfolio, Data Science & Cloud Infrastructure

5.1 OCI AI Architecture & The Three-Tier AI Portfolio 5.2 OCI Data Science & Managed Machine Learning Services 5.3 OCI AI High-Performance Infrastructure & Superclusters 5.4 Responsible AI Principles, Governance & Security in OCI

6 Chapter 6: OCI Generative AI & Oracle Database 23ai

6.1 OCI Generative AI Service: Models, Hosting & Dedicated Clusters 6.2 Autonomous Database Select AI & Natural Language SQL Generation 6.3 Oracle Database 23ai AI Vector Search & Enterprise Retrieval

7 Chapter 7: OCI Perceptual AI Services: Language & Speech

7.1 OCI Language Service: NLP, Sentiment Analysis, NER & PII Masking 7.2 OCI Speech Service: Automatic Speech Recognition & Acoustic Processing

8 Chapter 8: OCI Visual AI Services: Vision & Document Understanding

8.1 OCI Vision Service: Computer Vision, Classification & Object Detection 8.2 OCI Document Understanding: Automated Document Data Extraction

2.3 Unsupervised Learning: Clustering & Dimensionality Reduction

Key Takeaways Explain This Topic AI

Unsupervised learning discovers intrinsic structural patterns, natural groupings, and latent dimensional geometries within unlabeled datasets without human supervision.

k-Means partitions data into k spherical clusters by iteratively minimizing the within-cluster sum of squares (WCSS), with k determined via the Elbow Method and Silhouette Analysis.

DBSCAN relies on spatial density rather than distance to centroids, enabling it to detect arbitrary cluster topologies while natively isolating noise and outliers.

Dimensionality reduction mitigates the Curse of Dimensionality, with Principal Component Analysis (PCA) projecting features onto orthogonal axes that maximize variance.

Association rule mining identifies transactional co-occurrence patterns evaluated through three quantitative metrics: Support, Confidence, and Lift.

Last updated: September 2026

Unsupervised Learning: Clustering & Dimensionality Reduction

Exam Tip: On the OCI AI Foundations Associate (1Z0-1122-26) exam, understand how DBSCAN differs from k-Means regarding cluster shape and outlier handling. Pay close attention to Principal Component Analysis (PCA) as a variance-maximizing linear projection, and know how to interpret Lift in association rule mining (a Lift value greater than 1 indicates a genuine positive correlation between items).

Defining Unsupervised Learning

Unsupervised Learning processes datasets that contain exclusively feature vectors X = { x 1 , x 2 , … , x n } X = \{x_1, x_2, \dots, x_n\} X = { x 1 ​ , x 2 ​ , … , x n ​ } without associated ground-truth target labels y y y . Without a teacher or labeled feedback signal to calculate prediction errors, the objective is to discover underlying structural properties, probability densities, latent representations, or natural groupings within the data.

Key enterprise applications include customer segmentation in marketing, fraud and intrusion detection in cybersecurity, seismic analysis in energy exploration, and preprocessing compression for downstream supervised tasks.

Clustering Techniques

Clustering is the unsupervised task of partitioning an unlabeled dataset into subgroups (clusters) such that observations assigned to the same cluster share high similarity, while observations assigned to distinct clusters exhibit high dissimilarity.

1. k-Means Clustering

k-Means is an iterative, centroid-based partitioning algorithm that divides n n n observations into k k k distinct, non-overlapping clusters.

Algorithm Mechanics :

Initialization : The practitioner selects the hyperparameter k k k (number of clusters). The algorithm initializes k k k centroids randomly within feature space (or strategically via k-Means++ , which seeds initial centroids far apart to accelerate convergence and avoid poor local minima).

Assignment Step : Every observation is assigned to its nearest centroid, typically measured via Euclidean distance: c ( i ) = arg ⁡ min ⁡ j ∥ x ( i ) − μ j ∥ 2 c^{(i)} = \arg\min_j \| x^{(i)} - \mu_j \|^2 c ( i ) = ar g j min ​ ∥ x ( i ) − μ j ​ ∥ 2

Update Step : Each centroid's coordinates are recalculated as the mathematical mean of all data points assigned to that cluster: μ j = 1 ∣ S j ∣ ∑ i ∈ S j x ( i ) \mu_j = \frac{1}{|S_j|} \sum_{i \in S_j} x^{(i)} μ j ​ = ∣ S j ​ ∣ 1 ​ i ∈ S j ​ ∑ ​ x ( i )

Convergence : Steps 2 and 3 repeat iteratively until centroid positions stabilize (shift below an epsilon threshold) or a maximum iteration limit is reached.

Optimization Objective : Minimizing the Within-Cluster Sum of Squares (WCSS) , also referred to as cluster inertia : WCSS = ∑ j = 1 k ∑ x ∈ S j ∥ x − μ j ∥ 2 \text{WCSS} = \sum_{j=1}^{k} \sum_{x \in S_j} \| x - \mu_j \|^2 WCSS = j = 1 ∑ k ​ x ∈ S j ​ ∑ ​ ∥ x − μ j ​ ∥ 2

Determining the Optimal Number of Clusters ( k k k ) :

The Elbow Method : Plots WCSS against a range of sequential k k k values (e.g., k = 1 k=1 k = 1 to 10 10 10 ). As k k k increases, WCSS naturally decreases. The optimal k k k corresponds to the inflection point ("elbow") where the marginal decrease in WCSS slows noticeably.

Silhouette Analysis : Measures how close each point in a cluster is to points in neighboring clusters. The Silhouette Coefficient s ( i ) s(i) s ( i ) ranges from − 1.0 -1.0 − 1.0 to + 1.0 +1.0 + 1.0 : s ( i ) = b ( i ) − a ( i ) max ⁡ ( a ( i ) , b ( i ) ) s(i) = \frac{b(i) - a(i)}{\max(a(i), b(i))} s ( i ) = max ( a ( i ) , b ( i )) b ( i ) − a ( i ) ​ where a ( i ) a(i) a ( i ) is the mean intra-cluster distance between point i i i and all other points in its assigned cluster, and b ( i ) b(i) b ( i ) is the mean nearest-cluster distance from point i i i . A score near + 1.0 +1.0 + 1.0 indicates well-separated, dense clusters; a score near 0.0 0.0 0.0 indicates overlapping clusters; and negative scores suggest points assigned to the wrong cluster.

Limitations : k-Means requires pre-specifying k k k , is sensitive to outliers (which distort the mean), and assumes clusters are spherical, isotropic, and of equal variance.

2. Hierarchical Clustering

Hierarchical clustering builds a nested hierarchy of clusters visualized as a tree structure called a Dendrogram . By cutting the dendrogram horizontally at a chosen distance threshold, practitioners extract a specific number of clusters.

Hierarchical clustering operates via two distinct paradigms:

Agglomerative (Bottom-Up) : Begins with every observation treated as an individual singleton cluster ( n n n clusters). At each step, the two closest clusters are merged, repeating until all observations belong to a single global root cluster.

Divisive (Top-Down) : Begins with all observations grouped into one single cluster. The algorithm recursively splits clusters into smaller sub-clusters until every point forms its own singleton.

Linkage Criteria dictate how distance between two multi-point clusters is computed:

Single Linkage : Minimum distance between any single point in cluster A A A and any single point in cluster B B B (prone to chaining artifacts).

Complete Linkage : Maximum pairwise distance between points in A A A and B B B (produces compact, spherical clusters).

Average Linkage : Average distance across all pairwise point combinations.

Ward's Linkage : Minimizes the increase in total within-cluster variance resulting from merging the two clusters.

3. DBSCAN (Density-Based Spatial Clustering of Applications with Noise)

Unlike centroid-based or hierarchical methods, DBSCAN discovers clusters based on the local spatial density of observations, allowing it to identify clusters of arbitrary, complex geometric shapes while natively identifying outliers as noise .

DBSCAN relies on two primary hyperparameters:

Epsilon ( ϵ \epsilon ϵ ) : The radius defining the neighborhood surrounding any given data point.

MinPts : The minimum number of points required within the ϵ \epsilon ϵ -neighborhood to designate that region as dense.

Point Classification :

Core Point : Any point whose ϵ \epsilon ϵ -neighborhood contains at least MinPts \text{MinPts} MinPts (including the point itself).

Border Point : A point that falls within the ϵ \epsilon ϵ -neighborhood of a core point but contains fewer than MinPts \text{MinPts} MinPts within its own radius.

Noise / Outlier Point : Any point that is neither a core point nor a border point. These points are left unassigned, isolating anomalies natively.

Algorithm Pre-specified Clusters ( k k k )? Cluster Geometry Outlier Handling Computational Complexity

k-Means Yes (required upfront) Spherical, convex only Distorts centroids (poor) O ( n ⋅ k ⋅ i ) O(n \cdot k \cdot i) O ( n ⋅ k ⋅ i ) — highly scalable

Hierarchical No (cut dendrogram later) Determined by linkage Nested in tree (poor) O ( n 3 ) O(n^3) O ( n 3 ) or O ( n 2 log ⁡ n ) O(n^2 \log n) O ( n 2 lo g n ) — small datasets

DBSCAN No (discovered automatically) Arbitrary, non-linear shapes Explicitly labels noise (excellent) O ( n log ⁡ n ) O(n \log n) O ( n lo g n ) with spatial indexing

Dimensionality Reduction & The Curse of Dimensionality

In enterprise machine learning, datasets frequently encompass hundreds or thousands of features (e.g., genomic sequencing, text bag-of-words, high-resolution sensor telemetry). This scale introduces severe theoretical and computational hurdles.

The Curse of Dimensionality

As the number of dimensional features d d d increases, the volume of the feature space grows exponentially ( V ∝ r d V \propto r^d V ∝ r d ). This introduces three structural problems:

Data Sparsity : Training samples become isolated in vast empty space. The amount of training data required to maintain statistical sampling density grows exponentially with dimensionality.

Distance Metric Breakdown : In high-dimensional spaces, the Euclidean distance between the nearest neighbor and the furthest neighbor converges to nearly the same value. Consequently, distance-based algorithms (such as k-NN, k-Means, and SVM with RBF kernels) lose their discriminatory capability.

Overfitting & Latency : Large feature counts dramatically expand parameter counts, elevating overfitting risks while multiplying computational training and inference latency.

Principal Component Analysis (PCA)

Principal Component Analysis (PCA) is an unsupervised, linear dimensionality reduction technique. PCA projects high-dimensional data onto a lower-dimensional coordinate system defined by orthogonal (perpendicular) axes termed Principal Components (PCs) .

Mechanics :

The data is centered by subtracting the mean of each feature (and standardized to unit variance if features possess differing physical scales).

The algorithm calculates the covariance matrix of the standardized features.

An eigenvalue decomposition (or Singular Value Decomposition / SVD) of the covariance matrix is computed:

The resulting eigenvectors represent the directional orientations of the new principal component axes.

The corresponding eigenvalues quantify the amount of variance captured along each principal component.

The first principal component (PC1) accounts for the largest possible variance in the data. The second principal component (PC2) is strictly orthogonal to PC1 and captures the second largest variance, and so on.

Practitioners choose a subset of k k k principal components that preserve an acceptable threshold of cumulative explained variance (e.g., 90% or 95%), compressing the feature space from d d d dimensions down to k k k dimensions ( k ≪ d k \ll d k ≪ d ) while minimizing information loss.

Non-Linear Dimensionality Reduction for Visualization

While PCA is effective for linear compression, complex high-dimensional datasets often lie on non-linear manifolds:

t-SNE (t-Distributed Stochastic Neighbor Embedding) : A non-linear technique that maps high-dimensional points into a 2D or 3D visual space. It converts pairwise Euclidean distances into conditional probabilities and minimizes the Kullback-Leibler divergence between high-dimensional and low-dimensional representations using Student-t distributions. t-SNE excels at revealing local cluster structure but does not preserve global distances.

UMAP (Uniform Manifold Approximation and Projection) : A modern non-linear manifold learning algorithm based on Riemannian geometry. UMAP preserves both local neighborhood clusters and global data topology while executing significantly faster and scaling to larger sample sizes than t-SNE.

Association Rule Learning

Association Rule Learning is an unsupervised data mining paradigm designed to uncover strong relationships, affinities, and frequent co-occurrences among items within massive transactional datasets.

The classic application is Market Basket Analysis , which identifies purchasing patterns (e.g., "If a retail customer purchases bread and peanut butter, they are 80% likely to also purchase jelly"). Rules are formalized as implications: X ⟹ Y ( where X is the Antecedent and Y is the Consequent ) X \implies Y \quad (\text{where } X \text{ is the Antecedent and } Y \text{ is the Consequent}) X ⟹ Y ( where X is the Antecedent and Y is the Consequent )

The Three Core Association Metrics

Support : Support ( X ⟹ Y ) = Frequency ( X ∪ Y ) N \text{Support}(X \implies Y) = \frac{\text{Frequency}(X \cup Y)}{N} Support ( X ⟹ Y ) = N Frequency ( X ∪ Y ) ​

Measures the proportion of total transactions N N N that contain both itemsets X X X and Y Y Y . It assesses the overall statistical popularity of the combination.

Confidence : Confidence ( X ⟹ Y ) = Support ( X ∪ Y ) Support ( X ) \text{Confidence}(X \implies Y) = \frac{\text{Support}(X \cup Y)}{\text{Support}(X)} Confidence ( X ⟹ Y ) = Support ( X ) Support ( X ∪ Y ) ​

Measures the conditional probability that a customer purchases itemset Y Y Y , given that they have already purchased itemset X X X . It quantifies the operational reliability of the rule.

Lift : Lift ( X ⟹ Y ) = Confidence ( X ⟹ Y ) Support ( Y ) = P ( X ∩ Y ) P ( X ) × P ( Y ) \text{Lift}(X \implies Y) = \frac{\text{Confidence}(X \implies Y)}{\text{Support}(Y)} = \frac{P(X \cap Y)}{P(X) \times P(Y)} Lift ( X ⟹ Y ) = Support ( Y ) Confidence ( X ⟹ Y ) ​ = P ( X ) × P ( Y ) P ( X ∩ Y ) ​

Measures the strength of the association rule over what would be expected if X X X and Y Y Y were entirely statistically independent:

Lift = 1.0 \text{Lift} = 1.0 Lift = 1.0 : X X X and Y Y Y are independent; purchasing X X X has no effect on purchasing Y Y Y .

Lift > 1.0 \text{Lift} > 1.0 Lift > 1.0 : Positive affinity; purchasing X X X significantly increases the likelihood of purchasing Y Y Y .

Lift < 1.0 \text{Lift} < 1.0 Lift < 1.0 : Negative association (substitutes); purchasing X X X reduces the likelihood of purchasing Y Y Y .