Algorithm Search⌘K

Techniqueadvanced

Active subspaces

Also called active subspace method, gradient-based dimension reduction.

Finds the directions in input space along which the output changes most, from the eigenvectors of the average outer product of gradients.

Active subspaces find a few directions in the input space of a function f:Rm→Rf : \mathbb{R}^m \to \mathbb{R} along which ff changes most on average. With xx random with density ρ\rho, form the symmetric positive semidefinite matrix

C=E[∇f(x) ∇f(x)T]=WΛWT,λ1≥⋯≥λm≥0.C = \mathbb{E}\big[\nabla f(x)\, \nabla f(x)^{\mathsf T}\big] = W \Lambda W^{\mathsf T}, \qquad \lambda_1 \ge \cdots \ge \lambda_m \ge 0.

Each eigenvalue is the mean squared directional derivative along its eigenvector: λi=E[(wiT∇f)2]\lambda_i = \mathbb{E}[(w_i^{\mathsf T} \nabla f)^2]. If there is a gap after λn\lambda_n, split W=[W1 W2]W = [W_1\ W_2] and set y=W1Txy = W_1^{\mathsf T} x, the active variables, and z=W2Txz = W_2^{\mathsf T} x, the inactive ones. Then ff changes little with zz, and f(x)≈g(W1Tx)f(x) \approx g(W_1^{\mathsf T} x) for a function gg of only nn variables, which can be fit, integrated or optimized cheaply. CC is estimated by Monte Carlo from MM gradient samples. The method is like principal component analysis, but of the gradients of ff, not of the inputs. It finds rotated directions that no coordinate-wise sensitivity measure would see. Constantine, Dow and Wang gave the theory in 2014.

In plain words

A model can have 50 inputs and still depend mainly on one weighted combination of them, such as a total load. Testing one input at a time hides this, because the combination spreads over many inputs. Instead, measure the slope of the model at many random points, and collect the slope vectors. If they all point roughly along one line, that line is the important direction. An eigenvalue decomposition of the average of the slope vectors times themselves finds these lines and ranks them. The large eigenvalues mark the directions that matter. You then study the model as a function of the few important combinations only.

When it applies

  • The gradient ∇f\nabla f is available at sample points, by an adjoint solve, automatic differentiation or finite differences, and it is square integrable.
  • The inputs are scaled to comparable ranges, usually standard normal or uniform on [−1,1]m[-1, 1]^m. The eigenvectors change with the scaling.
  • The function has low dimensional structure along linear combinations of inputs: it is close to a ridge function g(W1Tx)g(W_1^{\mathsf T} x). The eigenvalues show whether this holds; a clear gap after λn\lambda_n is the sign.
  • For the error bound below, ρ\rho is the standard normal law. For other laws a Poincare constant of ρ\rho enters.

The template

  1. ACTIVE-SUBSPACE(f, ∇f, ρ, M)
  2. 1draw x_1..x_M from ρ ▷ hole: random or quasi-random points
  3. 2compute g_j ← ∇f(x_j) for each j ▷ hole: adjoint, AD, finite differences
  4. 3Ĉ ← (1/M) Σ_j g_j g_j^T ▷ or the SVD of [g_1..g_M] / √M
  5. 4Ĉ = Ŵ Λ̂ Ŵ^T with eigenvalues in decreasing order
  6. 5choose n at a large gap λ̂_n / λ̂_(n+1) ▷ hole: gap, bootstrap of the subspace
  7. 6y ← Ŵ_1^T x; fit g(y) ≈ f(x) from the runs ▷ hole: polynomial, kriging, nothing
  8. 7return Ŵ_1, the eigenvalues and g

Line L3 builds the estimate; with G=[g1⋯gM]/MG = [g_1 \cdots g_M] / \sqrt{M}, C^=GGT\hat C = G G^{\mathsf T}, so the singular value decomposition of GG gives W^\hat W and λ^i=σi2\hat\lambda_i = \sigma_i^2 without forming C^\hat C. Line L5 fixes the dimension, and line L6 uses it: a response surface, a polynomial chaos expansion or kriging in nn variables needs far fewer runs than in mm.

Gradients along the subspaces (proved). E[∥∇yf∥2]=λ1+⋯+λn\mathbb{E}[\|\nabla_y f\|^2] = \lambda_1 + \cdots + \lambda_n and E[∥∇zf∥2]=λn+1+⋯+λm\mathbb{E}[\|\nabla_z f\|^2] = \lambda_{n+1} + \cdots + \lambda_m, where ∇yf=W1T∇f\nabla_y f = W_1^{\mathsf T} \nabla f and ∇zf=W2T∇f\nabla_z f = W_2^{\mathsf T} \nabla f are the gradients in the rotated coordinates.

Proof. E[∥W1T∇f∥2]=E[tr⁡(W1T∇f∇fTW1)]=tr⁡(W1TCW1)=tr⁡(Λ1)\mathbb{E}[\|W_1^{\mathsf T} \nabla f\|^2] = \mathbb{E}[\operatorname{tr}(W_1^{\mathsf T} \nabla f \nabla f^{\mathsf T} W_1)] = \operatorname{tr}(W_1^{\mathsf T} C W_1) = \operatorname{tr}(\Lambda_1), since the columns of W1W_1 are eigenvectors of CC. The same holds for W2W_2. □\square

Error of the conditional mean (proved for Gaussian inputs). Let x∼N(0,I)x \sim N(0, I) and ff be continuously differentiable with E∥∇f∥2<∞\mathbb{E}\|\nabla f\|^2 < \infty. Then E[(f−E[f∣y])2]≤λn+1+⋯+λm\mathbb{E}[(f - \mathbb{E}[f \mid y])^2] \le \lambda_{n+1} + \cdots + \lambda_m.

Proof. WW is orthogonal, so (y,z)(y, z) is again standard normal, with yy and zz independent. For fixed yy, the Gaussian Poincare inequality in zz, Var⁡z[h(z)]≤Ez[∥∇h(z)∥2]\operatorname{Var}_z[h(z)] \le \mathbb{E}_z[\|\nabla h(z)\|^2], applied to h(z)=f(W1y+W2z)h(z) = f(W_1 y + W_2 z), gives E[(f−E[f∣y])2∣y]≤E[∥∇zf∥2∣y]\mathbb{E}[(f - \mathbb{E}[f \mid y])^2 \mid y] \le \mathbb{E}[\|\nabla_z f\|^2 \mid y]. Take the expectation over yy and use the previous result. □\square

So small trailing eigenvalues guarantee that the best function of yy alone is close to ff in mean square.

Classic examples

A ridge function. Let f(x)=sin⁡(x1+x2)f(x) = \sin(x_1 + x_2) with x∼N(0,I2)x \sim N(0, I_2). Then ∇f=cos⁡(x1+x2)(1,1)T\nabla f = \cos(x_1 + x_2)(1, 1)^{\mathsf T} and every gradient is parallel to (1,1)(1, 1). With s=x1+x2∼N(0,2)s = x_1 + x_2 \sim N(0, 2), E[cos⁡2s]=12+12e−4=0.5091578\mathbb{E}[\cos^2 s] = \frac{1}{2} + \frac{1}{2} e^{-4} = 0.5091578, so C=0.5091578C = 0.5091578 times the all-ones matrix, with eigenvalues 1.01831561.0183156 and 0 and eigenvector (1,1)/2(1, 1)/\sqrt{2}. The estimate C^\hat C has rank one for every MM, so λ^2=0\hat\lambda_2 = 0 and the direction is exact. With seed 1, λ^1\hat\lambda_1 is 1.435, 0.973, 0.998 and 1.021 for M=10,100,1000,10000M = 10, 100, 1000, 10000. Every function of the form h(aTx)h(a^{\mathsf T} x) has a rank one CC in the same way.

A rotated quadratic. Let f(x)=12xTAxf(x) = \frac{1}{2} x^{\mathsf T} A x in three inputs, x∼N(0,I3)x \sim N(0, I_3), with A=Qdiag⁡(1,0.5,0.1)QTA = Q \operatorname{diag}(1, 0.5, 0.1) Q^{\mathsf T} and QQ the Householder reflection of (1,1,1)/3(1, 1, 1)/\sqrt{3}. Then ∇f=Ax\nabla f = A x and C=A2C = A^2, with eigenvalues 1, 0.25 and 0.01, and leading eigenvector w1=(1,−2,−2)/3w_1 = (1, -2, -2)/3. The diagonal of CC, the mean squared partial derivatives, is (0.227,0.477,0.557)(0.227, 0.477, 0.557): no single input stands out, yet one direction carries 1/1.26=791 / 1.26 = 79 percent of the mean squared gradient. Monte Carlo estimates with seed 1:

MM λ^1\hat\lambda_1 λ^2\hat\lambda_2 λ^3\hat\lambda_3 angle of w^1\hat w_1 to w1w_1
10 0.759 0.068 0.0053 23.3 degrees
100 0.807 0.245 0.0104 4.08 degrees
1000 0.987 0.238 0.0102 0.094 degrees
10000 1.007 0.244 0.0101 0.213 degrees

The direction is accurate long before the eigenvalues are, because the gap between λ1\lambda_1 and λ2\lambda_2 is large. The error does not fall monotonically with MM for one seed.

Contrast with principal component analysis. PCA of the inputs of both examples sees the identity covariance and finds no preferred direction. Active subspaces use the function, through its gradients, and find the direction that matters.

Global sensitivity. Constantine and Diaz define activity scores ∑j≤nλjwij2\sum_{j \le n} \lambda_j w_{ij}^2 for each input ii. With n=mn = m the score is Cii=E[(∂f/∂xi)2]C_{ii} = \mathbb{E}[(\partial f / \partial x_i)^2], the derivative-based measure, which bounds the total Sobol index of input ii by a Poincare inequality. Screening by the Morris method estimates a related average of derivatives without gradients.

Variations

  • Finite difference and gradient-free estimates. Use differences when no adjoint exists, or fit a global linear or quadratic model and take its gradients.
  • Bootstrap. Resample the gradients to get intervals for the eigenvalues and for the distance between subspaces.
  • Different weights. Use the outer products of the gradients of several outputs, or of a misfit function in a Bayesian inverse problem, where the active subspace is the data-informed one.
  • Ridge approximation. Fit g(W1Tx)g(W_1^{\mathsf T} x) by optimizing W1W_1 and gg together from function values only, without gradients.
  • Nonlinear analogues. Active manifolds and kernel methods look for curved low dimensional structure.

Pitfalls

  • Scaling of inputs. The eigenvectors depend on the units. Normalize the inputs before computing gradients.
  • No linear structure. For f=∥x∥2f = \|x\|^2 with x∼N(0,I)x \sim N(0, I), ∇f=2x\nabla f = 2 x and C=4IC = 4 I: all eigenvalues are equal and there is no active subspace, though ff depends on the single scalar ∥x∥\|x\|. The method sees only linear combinations.
  • Too few gradients. With MM small, the eigenvalues are biased and the subspace is wrong when the gap is small, as the first row of the table shows. Use the bootstrap.
  • Noisy gradients. Finite differences of a model with solver noise add a noise matrix to C^\hat C, which hides small eigenvalues.
  • Dependent or bounded inputs. The rotated variables yy and zz are not independent when xx is not Gaussian, and the range of yy on a box is a zonotope, not a box. Account for this when fitting gg or integrating over yy.

Exercises

  1. Show that λi=E[(wiT∇f)2]\lambda_i = \mathbb{E}[(w_i^{\mathsf T} \nabla f)^2] and that tr⁡C=E[∥∇f∥2]\operatorname{tr} C = \mathbb{E}[\|\nabla f\|^2].
  2. For f(x)=h(aTx)f(x) = h(a^{\mathsf T} x), show that C=E[h′(aTx)2] aaTC = \mathbb{E}[h'(a^{\mathsf T} x)^2]\, a a^{\mathsf T} has rank at most one.
  3. Compute CC for f(x)=sin⁡(x1+x2)f(x) = \sin(x_1 + x_2) with xx uniform on [−1,1]2[-1, 1]^2 and compare it with the Gaussian case.
  4. Prove that C^\hat C has rank at most min⁡(M,m)\min(M, m), and explain why at least nn gradients are needed to find an nn dimensional subspace.
  5. For f=12xTAxf = \frac{1}{2} x^{\mathsf T} A x with symmetric AA and x∼N(0,I)x \sim N(0, I), show that C=A2C = A^2.

References

  1. Paul G. Constantine, Eric Dow and Qiqi Wang, Active subspace methods in theory and practice, applications to kriging surfaces, SIAM Journal on Scientific Computing 36(4), 2014, A1500-A1524, the matrix of averaged outer products of gradients, the bounds on the mean squared gradients along the active and inactive directions by sums of eigenvalues, the Poincare bound on the error of the conditional mean, and the Monte Carlo estimate of the matrix
  2. Paul G. Constantine, Active Subspaces, Emerging Ideas for Dimension Reduction in Parameter Studies, SIAM Spotlights 2, SIAM, 2015, the discovery of the active subspace from gradient samples, the choice of its dimension by the eigenvalue gap, and its use for response surfaces, integration and optimization
  3. Paul G. Constantine and Paul Diaz, Global sensitivity metrics from active subspaces, Reliability Engineering and System Safety 162, 2017, 1-13, the activity scores built from the leading eigenpairs and their relation to derivative-based global sensitivity measures

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • three classic examples