Tutorials › Statistical Learning (Graduate) › Kernel Rescaling and Regularization Calibration

Kernel Ridge Rates and Source Conditions · Tutorial 738 of 989

Kernel Rescaling and Regularization Calibration

Learn how kernel amplitude changes the spectrum, and how to recalibrate regularization so that kernel ridge regression is unchanged.

Advanced 10 min read

What You'll Learn

  • Relate a rescaled kernel to its covariance operator and eigenvalues.
  • Derive how the RKHS norm changes when the kernel is multiplied by a positive constant.
  • Convert a kernel-ridge regularization value between two kernel scales.
  • Verify predictor invariance using the Gram-matrix formula.
  • Identify how unadjusted tuning values alter effective regularization.
  • Compare effective dimensions under correctly matched and mismatched scales.

Why Kernel Scale and Regularization Must Be Calibrated Together

A kernel has an amplitude as well as a shape. Multiplying every kernel value by the same positive constant preserves which inputs are similar relative to one another, but it changes the size of the associated covariance spectrum and the scale of the RKHS penalty. Consequently, a regularization value that worked with one kernel scale does not generally carry over unchanged to another.

This is important when kernels are normalized, when a kernel is multiplied by a constant during model construction, or when a tuning value is transferred between software implementations. The key principle is precise: under the usual kernel-ridge objective with average squared error, multiplying the kernel by \(c>0\) requires multiplying the regularization parameter by \(c\) to preserve the fitted function.

Kernel Rescaling and the Covariance Spectrum

Let \(K\) be a measurable, symmetric, positive semidefinite kernel on an input space with distribution \(P_X\). Assume \(E[K(X,X)]<\infty\), so its covariance (integral) operator on \(L_2(P_X)\) is positive and trace class. It is defined by

$$ (T_K g)(x)=\int K(x,x')g(x')\,dP_X(x'). $$

Write the nonzero eigenvalues of \(T_K\), counted with multiplicity, as \(\mu_1,\mu_2,\ldots\). For a positive constant \(c\), define \(K_c=cK\).

Definition: The rescaled kernel \(K_c\) is obtained by multiplying every value of \(K\) by \(c>0\). Its covariance operator is \(T_{K_c}\). The effective dimension at \(\lambda>0\) is \(N_K(\lambda)=\operatorname{Tr}\!\left[T_K(T_K+\lambda I)^{-1}\right]\), where \(I\) is the identity operator.

The covariance operator is linear in the kernel. Thus the spectrum scales by \(c\), while the effective dimension is preserved only when its regularization argument scales by the same factor.

Result: \(T_{K_c}=cT_K\), so its nonzero eigenvalues are \(c\mu_j\), with the same eigenfunctions and multiplicities. Moreover, \(N_{K_c}(\lambda)=N_K(\lambda/c)\).

To verify the effective-dimension identity, use the eigenvalues of \(T_K\) to write \(N_{K_c}(\lambda)=\sum_j c\mu_j/(c\mu_j+\lambda)\). Dividing numerator and denominator of each summand by \(c\) gives \(\sum_j\mu_j/(\mu_j+\lambda/c)=N_K(\lambda/c)\). The sums are well-defined because the operators are positive and trace class, and each summand is bounded above by \(c\mu_j/\lambda\), whose sum is finite.

What Rescaling Does to the RKHS Penalty

The spectrum is only one part of the calibration. Kernel ridge regression penalizes the RKHS norm, and rescaling the kernel changes that norm too. Let \(\mathcal H_K\) denote the reproducing kernel Hilbert space of \(K\). For \(K_c=cK\), the two RKHSs contain the same functions, but their inner products differ.

Result: As sets, \(\mathcal H_{K_c}=\mathcal H_K\), and for every \(f\) in this space, \(\|f\|_{\mathcal H_{K_c}}^2=c^{-1}\|f\|_{\mathcal H_K}^2\).

Here is a proof. Give the common set of functions the inner product \(\langle f,g\rangle_{\mathcal H_{K_c}}=c^{-1}\langle f,g\rangle_{\mathcal H_K}\). This is an inner product and makes the space complete, since multiplying a norm by a positive constant does not change completeness. For each input \(x\), let \(K_x=K(\,\cdot\,,x)\). The section of \(K_c\) at \(x\) is \(cK_x\). By the reproducing property in \(\mathcal H_K\),

$$ \langle f,cK_x\rangle_{\mathcal H_{K_c}} =c^{-1}\langle f,cK_x\rangle_{\mathcal H_K} =\langle f,K_x\rangle_{\mathcal H_K} =f(x). $$

Thus the proposed inner product has reproducing kernel \(K_c\), so it gives its RKHS. The norm identity follows directly from the definition of that inner product. \(\square\)

Consider kernel ridge regression with training inputs \(x_1,\ldots,x_n\), responses collected in \(y\), and the average-loss objective

$$ \frac{1}{n}\sum_{i=1}^n\bigl(y_i-f(x_i)\bigr)^2 +\lambda\|f\|_{\mathcal H_K}^2,\qquad \lambda>0. $$

If the kernel is replaced by \(K_c\), its objective with parameter \(\lambda_c\) uses the penalty \(\lambda_c\|f\|_{\mathcal H_{K_c}}^2=(\lambda_c/c)\|f\|_{\mathcal H_K}^2\). It matches the original objective exactly when \(\lambda_c/c=\lambda\).

Calibration rule: To preserve the fitted function when replacing \(K\) by \(K_c=cK\), replace \(\lambda\) by \(\lambda_c=c\lambda\). Conversely, a value \(\lambda_c\) used with \(cK\) corresponds to \(\lambda_c/c\) when expressed on the original kernel scale.

This equality of objectives proves equality of their minimizers whenever the minimizer is unique. For \(\lambda>0\), the squared RKHS norm makes the objective strictly convex in \(f\), so its minimizer is unique.

Gram-Matrix Verification

The same calibration can be checked directly for the fitted predictor. Let \(G\) be the \(n\times n\) Gram matrix with entries \(G_{ij}=K(x_i,x_j)\). Kernel ridge regression with the average-loss convention has coefficient vector \(\alpha=(G+n\lambda I_n)^{-1}y\), and prediction \(\hat f(x)=\sum_{i=1}^n\alpha_iK(x_i,x)\).

With \(K_c=cK\), the Gram matrix becomes \(cG\). Choosing \(\lambda_c=c\lambda\) gives

$$ \alpha_c=(cG+n c\lambda I_n)^{-1}y =\frac{1}{c}(G+n\lambda I_n)^{-1}y =\frac{\alpha}{c}. $$

The new prediction is therefore \(\sum_i(\alpha_i/c)cK(x_i,x)=\sum_i\alpha_iK(x_i,x)\), identical to the original prediction for every \(x\). This derivation also shows where the factor \(n\) appears: it comes from using average squared error. If the objective instead uses the sum of squared errors, the Gram formula has \(\lambda I_n\) rather than \(n\lambda I_n\), but the kernel-scale conversion remains \(\lambda_c=c\lambda\).

Worked Example: Matching Two Gram-Matrix Fits

Take \(n=2\), \(G=\operatorname{diag}(2,1)\), response vector \(y=(1,2)^\top\), and \(\lambda=0.2\). The coefficient vector under the original kernel is \(\alpha=(G+2\lambda I_2)^{-1}y\). Since \(2\lambda=0.4\),

\(\alpha=(\operatorname{diag}(2.4,1.4))^{-1}(1,2)^\top=(1/2.4,2/1.4)^\top=(5/12,10/7)^\top\).

Now multiply the kernel by \(c=5\). Its Gram matrix is \(\operatorname{diag}(10,5)\), and the calibrated value is \(\lambda_c=5(0.2)=1\). The new coefficients are \(\alpha_c=(\operatorname{diag}(10+2,5+2))^{-1}(1,2)^\top=(1/12,2/7)^\top=\alpha/5\).

Each kernel value is five times as large while each coefficient is one fifth as large. Their products, and hence all predictions, are unchanged. If the value \(0.2\) were retained instead, the denominators would be \(10.4\) and \(5.4\), not \(12\) and \(7\); that would be a different fit.

Worked Spectrum and Effective Dimension

Worked Example: Comparing Effective Dimensions

Suppose the nonzero covariance eigenvalues of \(K\) are \(8,2,0.5\), and the regularization value is \(\lambda=0.5\). The effective dimension is

\(N_K(0.5)=8/(8+0.5)+2/(2+0.5)+0.5/(0.5+0.5)=16/17+4/5+1/2\approx 2.2412\).

Rescale the kernel by \(c=3\). The eigenvalues become \(24,6,1.5\). The matching regularization value is \(1.5\), and \(N_{3K}(1.5)=24/(24+1.5)+6/(6+1.5)+1.5/(1.5+1.5)=16/17+4/5+1/2\approx 2.2412\).

If the old value \(0.5\) is incorrectly retained, then \(N_{3K}(0.5)=24/24.5+6/6.5+1.5/2=48/49+12/13+3/4\approx 2.6527\). The larger effective dimension reflects weaker regularization relative to the rescaled spectrum.

Worked Example: A Small Kernel Scale

Worked Example: Diagnosing an Unchanged Tuning Value

Use a one-observation training set with Gram matrix \(G=[4]\), response \(y=1\), and \(\lambda=0.2\). Under the average-loss convention, the fitted value at the observed input is \(4/(4+1(0.2))=4/4.2=20/21\).

Now scale the kernel by \(c=0.01\), so the Gram matrix is \([0.04]\). The equivalent value is \(\lambda_c=0.01(0.2)=0.002\). The fitted value is \(0.04/(0.04+0.002)=0.04/0.042=20/21\), as required.

If \(0.2\) is transferred without adjustment, the fitted value becomes \(0.04/(0.04+0.2)=0.04/0.24=1/6\). The kernel and tuning value have not been changed in a coordinated way: relative to the smaller kernel, the unchanged penalty is much stronger, and the fit is pulled much closer to zero.

Common Mistakes and Practical Interpretation

  • Keeping \(\lambda\) fixed after changing kernel amplitude. The same numerical value does not represent the same regularization. If the kernel is multiplied by \(c\), the matching value is \(c\lambda\).
  • Scaling \(\lambda\) in the opposite direction. The RKHS norm squared becomes \(1/c\) as large for the same function, so the coefficient on that norm must become \(c\lambda\), not \(\lambda/c\).
  • Comparing eigenvalues without comparing the regularization scale. The relevant effective-dimension terms are \(c\mu_j/(c\mu_j+\lambda_c)\). Matching them requires matching \(\lambda_c/c\), not merely noting that the eigenvalues have changed.
  • Assuming shape determines a tuning value. Two kernels can have the same relative pattern of similarities and different overall amplitudes. Tuning values are meaningful only relative to the kernel scale and the objective convention.

In practice, a reported tuning value is not portable without its kernel normalization and loss convention. A data-dependent normalization can even make the scale vary across analyses, so the calibration must use the actual multiplicative factor applied to the kernel. This scaling identity does not say that rescaling improves prediction; it says that a pure change of units leaves the fit unchanged only when regularization is converted consistently.

Key takeaway: Replacing \(K\) by \(cK\) multiplies covariance eigenvalues by \(c\), divides the squared RKHS norm of a fixed function by \(c\), and requires \(\lambda\) to be multiplied by \(c\) for the same kernel-ridge fit.

Check Your Understanding

Use the scaling rule and the definitions above to answer the following.

  1. If \(K\) is multiplied by \(4\), what regularization value corresponds to an original value of \(0.3\)?
  2. Why does the effective dimension remain unchanged when both the kernel and \(\lambda\) are multiplied by the same positive constant?
  3. A kernel is scaled by \(0.1\), but the original \(\lambda\) is retained. Does this make regularization stronger or weaker relative to the kernel scale? Explain.
  4. For a Gram matrix \(G\) and average-loss objective, write the coefficient vector for the rescaled kernel using the calibrated parameter, and relate it to the original coefficient vector.
  5. What information is needed before transferring a numerical tuning value from one kernel implementation to another?
Clinical Biostats