Foundations to Frontier
Tests

Subspace Clustering

Subspace clustering handles data that lie on a union of low-dimensional subspaces, such as feature trajectories of independently moving objects, face images under varying light, or sensor signals driven by a few latent factors. Points of different groups can be close to each other (all subspaces pass through the origin), so distance-to-centre and density methods fail. Algebraic and iterative methods instead model each group by its subspace: K-subspaces alternates assignment by projection residual with PCA refits. Self-expressive methods write each point as a combination of the others (sparse subspace clustering, low-rank representation, least-squares regression) and cluster the resulting affinity spectrally. Axis-parallel variants (CLIQUE, PROCLUS) look for clusters in subsets of features. This page covers the union-of-subspaces model, K-subspaces, self-expressiveness and its block-diagonal property, principal angles, and robustness to noise. In the exercises you implement K-subspaces and least-squares self-expressive clustering; then you compare them with Euclidean methods as noise grows.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Groups that are lines, not blobs

Some data don’t form blobs; each group lies along its own line or plane through a common point. Points from different groups can be right next to each other near that point, so “nearest centre” or “dense region” can’t separate them. Subspace clustering asks a different question: which line (or plane) does each point lie on?

  • Fit one subspace per group.
  • Assign each point to the subspace it is closest to, measured perpendicular to the subspace.
  • Repeat.
Subspace clustering: three lines through one point
points on their own line's cluster 98.9%
Every line passes through the origin (ringed), so points near it belong to all three lines at once in distance terms. k-means slices space into convex cells around centres and cuts the lines into pieces. K-subspaces asks which line each point is closest to, measured perpendicular to the line, which is the right notion for data lying on subspaces. Noise blurs the lines; near the origin even K-subspaces must guess.
Why engineers care

In computer vision, tracked feature points on each independently moving rigid object span their own low-dimensional subspace, so motion segmentation is subspace clustering. Face images of one person under all lighting conditions lie near a 9-D subspace. In telemetry, each operating mode may be governed by a few latent factors. Subspace methods find those groups where distance-based clustering cannot.

📝 Quick check (Level 0)
0/3 answered
  1. 1. In subspace clustering, each group is modelled by…
  2. 2. Why does k-means fail on lines through the origin?
  3. 3. A point is assigned to the subspace with the smallest…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

Residuals, fits and angles by hand

Projection residual. For a subspace with orthonormal basis U, the residual of x is ‖x − UUᵀx‖. For the x-axis in 3-D, U = (1, 0, 0)ᵀ, and x = (3, 4, 0) has projection (3, 0, 0), so the residual is 4.

Fitting a subspace. The best d-dimensional subspace through the origin for a set of points is spanned by the top d right singular vectors of the data matrix (PCA without centring). Points (1, 1, 0), (2, 2, 0) and (−1, −1, 0) give the direction (1, 1, 0)/√2.

Principal angles measure how different two subspaces are. The smallest angle comes from the largest singular value of U₁ᵀU₂. For the x-axis and a line at 30°, the angle is 30°; for the x- and y-axes it is 90°. Small angles make clustering hard.

Independence. Subspaces of dimensions d₁, …, d_k are independent if the dimension of their sum is d₁ + … + d_k. Three 2-D planes in R⁶ can be independent (2 + 2 + 2 = 6); three in R⁴ cannot.

The steps in plain English (K-subspaces):

  1. Choose k and the subspace dimension d. Start from random assignments (several restarts).
  2. For each group, fit a d-dimensional subspace by SVD of its points.
  3. Reassign each point to the subspace with the smallest projection residual.
  4. Repeat until assignments stop changing. Keep the restart with the smallest total residual.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Residual of (0, 5, 0) from the x-axis?
  2. 2. Smallest principal angle between the x-axis and the y-axis?
  3. 3. Can three 2-D planes in R⁴ be independent?

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 30 minUndergraduate students and practising engineers.

K-subspaces and self-expressiveness

K-subspaces (k-planes) is the k-means of subspaces. It alternates projection-residual assignment with SVD refits, and its total residual never increases. Like k-means, it needs restarts and the subspace dimension.

Self-expressiveness. A point on a subspace can be written as a combination of other points from the same subspace. Writing X ≈ CX with diag(C) = 0 and asking for “simple” C reveals the groups through the non-zero pattern of C:

  • Sparse subspace clustering (SSC): minimise ‖C‖₁ (Elhamifar and Vidal, 2013).
  • Low-rank representation (LRR): minimise the nuclear norm (Liu et al., 2013).
  • Least-squares regression (LSR): minimise ‖X − CX‖² + λ‖C‖², which has a closed form, C = (XXᵀ + λI)⁻¹XXᵀ (Lu et al., 2012).

Then build the affinity |C| + |C|ᵀ and run spectral clustering. For independent subspaces and noiseless data, these solutions are block-diagonal: points use only their own subspace.

Exercise 1 used three random planes in R⁶ with small noise:

  • K-subspaces and LSR + spectral both reached ARI 1.000;
  • k-means reached 0.031.

Noise. Noise pushes points off their subspaces, residuals overlap, and self-expression starts borrowing across subspaces. In exercise 2, both subspace methods fell from 1.00 (noise 0.02) to about 0.9 at noise 0.1, and to about 0.45 at 0.3. Euclidean methods were useless at every noise level.

Axis-parallel subspace clustering. When clusters live in subsets of the original features (some sensors matter for some faults), grid- and density-based methods search feature subsets. CLIQUE (Agrawal et al., 1998) works bottom-up over dense grid cells; PROCLUS (Aggarwal et al., 1999) is a projected k-medoids.

G = X @ X.T                                                   # rows of X are points
C = np.linalg.solve(G + lam * np.eye(len(X)), G); np.fill_diagonal(C, 0)
labels = SpectralClustering(3, affinity="precomputed").fit_predict(np.abs(C) + np.abs(C).T)
🐍 Exercise 1: K-subspaces and least-squares subspace clustering
Generate a union of subspaces, implement K-subspaces (SVD fits, residual assignment, restarts) and least-squares self-expression with spectral clustering; separate three planes through the origin that defeat k-means.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Self-expressive methods write each point as…
  2. 2. For independent subspaces and clean data, C is…
  3. 3. LSR's advantage over SSC is…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Block-diagonal property. If the subspaces are independent and C minimises a norm satisfying the “enforced block-diagonal” conditions (ℓ₁, nuclear, Frobenius), the optimal C is block-diagonal (Lu et al., 2012). SSC has stronger guarantees: even for disjoint, non-independent subspaces, its ℓ₁ solution uses only same-subspace points under conditions on principal angles and data distribution (Elhamifar and Vidal; Soltanolkotabi and Candès). That is the “subspace detection property”.

Hardness and identifiability. Generalised PCA (Vidal, Ma and Sastry) fits a union of subspaces algebraically, as the zero set of polynomials, but it is sensitive to noise. K-subspaces is NP-hard to optimise exactly, as k-means is, and it is a local search.

Principal angles control difficulty. When two subspaces share directions (small principal angles), points near their intersection are ambiguous for every method. Noise widens the ambiguous region.

Interview questions.

  • When is subspace clustering appropriate? When groups are governed by linear structure through a common point or low-rank factors, such as rigid-body motion, illumination, or linear dynamics; not for blob-like clusters.
  • How do you choose the subspace dimension? Use domain knowledge (rigid motion in an affine camera gives dimension ≤ 4), the singular-value gaps of each group, or let self-expressive methods find it implicitly.
📝 Quick check (Level 3)
0/3 answered
  1. 1. The subspace detection property guarantees…
  2. 2. Generalised PCA represents a union of subspaces as…
  3. 3. Clustering is hardest when subspaces have…

Level 4: Expert

★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.

How much noise can subspace methods take?

History.

  • R. Agrawal et al. (1998) introduced CLIQUE for axis-parallel subspace clusters.
  • P. Bradley and O. Mangasarian (2000) proposed k-plane clustering.
  • R. Vidal, Y. Ma and S. Sastry (2005) developed generalised PCA.
  • E. Elhamifar and R. Vidal (2009, 2013) introduced sparse subspace clustering; G. Liu et al. (2010, 2013) low-rank representation.
  • C. Lu et al. (2012) proposed least-squares regression subspace clustering.

Exercise 2. Three random planes through the origin in R⁶, 60 points each, 3 datasets. Values are mean ARI.

noise σ K-subspaces LSR + spectral RBF spectral k-means
0.02 1.000 1.000 0.061 0.016
0.1 0.918 0.865 0.024 0.015
0.3 0.443 0.474 0.008 0.013
0.6 0.130 0.094 0.015 0.010
  • The right model beats the right algorithm. Both subspace methods dominated both Euclidean ones at every noise level. The Euclidean methods never beat ARI 0.06, because the clusters aren’t separated in distance at all.
  • Both subspace methods degrade at a similar rate. At σ = 0.3 the noise variance per point (about 0.54 summed over 6 dimensions) was a quarter of the in-subspace variance (2), and recovery halved.
  • Neither method dominated the other. K-subspaces was slightly better at low noise, LSR at σ = 0.3.
🐍 Exercise 2 (research): subspace methods under noise
On three planes through the origin in R⁶, compare K-subspaces, least-squares self-expressive spectral clustering, RBF spectral clustering and k-means as noise grows from 0.02 to 0.6.

Subspace clustering in AI, robotics and aerospace

  • Motion segmentation: separating independently moving objects from tracked feature trajectories (each rigid motion spans a subspace of dimension at most 4).
  • Face and object recognition under varying illumination, where images of one object lie near a low-dimensional subspace.
  • Fault isolation: sensor data of each fault mode lying on its own low-rank structure.

References

  1. R. Vidal (2011). “Subspace clustering.” IEEE Signal Processing Magazine 28(2).
  2. E. Elhamifar, R. Vidal (2013). “Sparse subspace clustering: algorithm, theory, and applications.” IEEE TPAMI 35(11).
  3. G. Liu, Z. Lin, S. Yan, J. Sun, Y. Yu, Y. Ma (2013). “Robust recovery of subspace structures by low-rank representation.” IEEE TPAMI 35(1).
  4. C.-Y. Lu, H. Min, Z.-Q. Zhao, L. Zhu, D.-S. Huang, S. Yan (2012). “Robust and efficient subspace segmentation via least squares regression.” Proc. ECCV.
  5. R. Agrawal, J. Gehrke, D. Gunopulos, P. Raghavan (1998). “Automatic subspace clustering of high dimensional data for data mining applications.” Proc. ACM SIGMOD.