Bayesian interpretation of kernel regularization

From HandWiki
Revision as of 20:12, 15 February 2026 by OrgMain (talk | contribs) (add)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Bayesian interpretation of kernel regularization examines how kernel methods in machine learning can be understood through the lens of Bayesian statistics, a framework that uses probability to model uncertainty. Kernel methods are founded on the concept of similarity between inputs within a structured space. While techniques like support vector machines (SVMs) and their regularization (a technique to make a model more generalizable and transferable) were not originally formulated using Bayesian principles, analyzing them from a Bayesian perspective provides valuable insights.

In the Bayesian framework, kernel methods serve as a fundamental component of Gaussian processes, where the kernel function operates as a covariance function that defines relationships between inputs. Traditionally, these methods have been applied to supervised learning problems where inputs are represented as vectors and outputs as scalars. Recent developments have extended kernel methods to handle multiple outputs, as seen in multi-task learning.[1]

The mathematical framework for kernel methods typically involves reproducing kernel Hilbert spaces (RKHS). Not all kernels form inner product spaces, as they may not always be positive semidefinite (a property ensuring non-negative similarity measures), but they still operate within these more general RKHS. A mathematical equivalence between regularization approaches and Bayesian methods can be established, particularly in cases where the reproducing kernel Hilbert space is finite-dimensional. This equivalence demonstrates how both perspectives converge to essentially the same estimators, revealing the underlying connection between these seemingly different approaches.

The supervised learning problem

The classical supervised learning problem requires estimating the output for some new input point 𝐱 by learning a scalar-valued estimator f^(𝐱) on the basis of a training set S consisting of n input-output pairs, S=(𝐗,𝐘)=(𝐱1,y1),,(𝐱n,yn).[2] Given a symmetric and positive bivariate function k(,) called a kernel, one of the most popular estimators in machine learning is given by

f^(𝐱)=𝐤(𝐊+λn𝐈)1𝐘,

 

 

 

 

(1)

where 𝐊k(𝐗,𝐗) is the kernel matrix with entries 𝐊ij=k(𝐱i,𝐱j), 𝐤=[k(𝐱1,𝐱),,k(𝐱n,𝐱)], and 𝐘=[y1,,yn]. We will see how this estimator can be derived both from a regularization and a Bayesian perspective.

A regularization perspective

The main assumption in the regularization perspective is that the set of functions is assumed to belong to a reproducing kernel Hilbert space k.[2][3][4][5]

Reproducing kernel Hilbert space

A reproducing kernel Hilbert space (RKHS) k is a Hilbert space of functions defined by a symmetric, positive-definite function k:𝒳×𝒳 called the reproducing kernel such that the function k(𝐱,) belongs to k for all 𝐱𝒳.[6][7][8] There are three main properties that make an RKHS appealing:

1. The reproducing property, after which the RKHS is named,

f(𝐱)=f,k(𝐱,)k, fk,

where ,k is the inner product in k.

2. Functions in an RKHS are in the closure of the linear combination of the kernel at given points,

f(𝐱)=ik(𝐱i,𝐱)ci.

This allows the construction in a unified framework of both linear and generalized linear models.

3. The squared norm in an RKHS can be written as

fk2=i,jk(𝐱i,𝐱j)cicj

and could be viewed as measuring the complexity of the function.

The regularized functional

The estimator is derived as the minimizer of the regularized functional

1ni=1n(f(𝐱i)yi)2+λfk2,

 

 

 

 

(2)

where fk and k is the norm in k. The first term in this functional, which measures the average of the squares of the errors between the f(𝐱i) and the yi, is called the empirical risk and represents the cost we pay by predicting f(𝐱i) for the true value yi. The second term in the functional is the squared norm in a RKHS multiplied by a weight λ and serves the purpose of stabilizing the problem[3][5] as well as of adding a trade-off between fitting and complexity of the estimator.[2] The weight λ, called the regularizer, determines the degree to which instability and complexity of the estimator should be penalized (higher penalty for increasing value of λ).

Derivation of the estimator

The explicit form of the estimator in equation (1) is derived in two steps. First, the representer theorem[9][10][11] states that the minimizer of the functional (2) can always be written as a linear combination of the kernels centered at the training-set points,

f^(𝐱)=i=1ncik(𝐱i,𝐱)=𝐤𝐜,

 

 

 

 

(3)

for some 𝐜n. The explicit form of the coefficients 𝐜=[c1,,cn] can be found by substituting for f() in the functional (2). For a function of the form in equation (3), we have that

fk2=f,fk,=i=1Ncik(𝐱i,),j=1Ncjk(𝐱j,)k,=i=1Nj=1Ncicjk(𝐱i,),k(𝐱j,)k,=i=1Nj=1Ncicjk(𝐱i,𝐱j),=𝐜𝐊𝐜.

We can rewrite the functional (2) as

1n𝐲𝐊𝐜2+λ𝐜𝐊𝐜.

This functional is convex in 𝐜 and therefore we can find its minimum by setting the gradient with respect to 𝐜 to zero,

1n𝐊(𝐘𝐊𝐜)+λ𝐊𝐜=0,(𝐊+λn𝐈)𝐜=𝐘,𝐜=(𝐊+λn𝐈)1𝐘.

Substituting this expression for the coefficients in equation (3), we obtain the estimator stated previously in equation (1),

f^(𝐱)=𝐤(𝐊+λn𝐈)1𝐘.

A Bayesian perspective

The notion of a kernel plays a crucial role in Bayesian probability as the covariance function of a stochastic process called the Gaussian process.

A review of Bayesian probability

As part of the Bayesian framework, the Gaussian process specifies the prior distribution that describes the prior beliefs about the properties of the function being modeled. These beliefs are updated after taking into account observational data by means of a likelihood function that relates the prior beliefs to the observations. Taken together, the prior and likelihood lead to an updated distribution called the posterior distribution that is customarily used for predicting test cases.

The Gaussian process

A Gaussian process (GP) is a stochastic process in which any finite number of random variables that are sampled follow a joint Normal distribution.[12] The mean vector and covariance matrix of the Gaussian distribution completely specify the GP. GPs are usually used as a priori distribution for functions, and as such the mean vector and covariance matrix can be viewed as functions, where the covariance function is also called the kernel of the GP. Let a function f follow a Gaussian process with mean function m and kernel function k,

f𝒢𝒫(m,k).

In terms of the underlying Gaussian distribution, we have that for any finite set 𝐗={𝐱i}i=1n if we let f(𝐗)=[f(𝐱1),,f(𝐱n)] then

f(𝐗)𝒩(𝐦,𝐊),

where 𝐦=m(𝐗)=[m(𝐱1),,m(𝐱N)] is the mean vector and 𝐊=k(𝐗,𝐗) is the covariance matrix of the multivariate Gaussian distribution.

Derivation of the estimator

In a regression context, the likelihood function is usually assumed to be a Gaussian distribution and the observations to be independent and identically distributed (iid),

p(y|f,𝐱,σ2)=𝒩(f(𝐱),σ2).

This assumption corresponds to the observations being corrupted with zero-mean Gaussian noise with variance σ2. The iid assumption makes it possible to factorize the likelihood function over the data points given the set of inputs 𝐗 and the variance of the noise σ2, and thus the posterior distribution can be computed analytically. For a test input vector 𝐱, given the training data S={𝐗,𝐘}, the posterior distribution is given by

p(f(𝐱)|S,𝐱,ϕ)=𝒩(m(𝐱),σ2(𝐱)),

where ϕ denotes the set of parameters which include the variance of the noise σ2 and any parameters from the covariance function k and where

m(𝐱)=𝐤(𝐊+σ2𝐈)1𝐘,σ2(𝐱)=k(𝐱,𝐱)𝐤(𝐊+σ2𝐈)1𝐤.

The connection between regularization and Bayes

A connection between regularization theory and Bayesian theory can only be achieved in the case of finite dimensional RKHS. Under this assumption, regularization theory and Bayesian theory are connected through Gaussian process prediction.[3][12][13]

In the finite dimensional case, every RKHS can be described in terms of a feature map Φ:𝒳p such that[2]

k(𝐱,𝐱)=i=1pΦi(𝐱)Φi(𝐱).

Functions in the RKHS with kernel 𝐊 can then be written as

f𝐰(𝐱)=i=1p𝐰iΦi(𝐱)=𝐰,Φ(𝐱),

and we also have that

f𝐰k=𝐰.

We can now build a Gaussian process by assuming 𝐰=[w1,,wp] to be distributed according to a multivariate Gaussian distribution with zero mean and identity covariance matrix,

𝐰𝒩(0,𝐈)exp(𝐰2).

If we assume a Gaussian likelihood we have

P(𝐘|𝐗,f)=𝒩(f(𝐗),σ2𝐈)exp(1σ2f𝐰(𝐗)𝐘2),

where f𝐰(𝐗)=(𝐰,Φ(𝐱1),,𝐰,Φ(𝐱n). The resulting posterior distribution is then given by

P(f|𝐗,𝐘)exp(1σ2f𝐰(𝐗)𝐘n2+𝐰2)

We can see that a maximum posterior (MAP) estimate is equivalent to the minimization problem defining Tikhonov regularization, where in the Bayesian case the regularization parameter is related to the noise variance.

From a philosophical perspective, the loss function in a regularization setting plays a different role than the likelihood function in the Bayesian setting. Whereas the loss function measures the error that is incurred when predicting f(𝐱) in place of y, the likelihood function measures how likely the observations are from the model that was assumed to be true in the generative process. From a mathematical perspective, however, the formulations of the regularization and Bayesian frameworks make the loss function and the likelihood function to have the same mathematical role of promoting the inference of functions f that approximate the labels y as much as possible.

See also

References

  1. Álvarez, Mauricio A.; Rosasco, Lorenzo; Lawrence, Neil D. (June 2011). "Kernels for Vector-Valued Functions: A Review". arXiv:1106.6251 [stat.ML].
  2. 2.0 2.1 2.2 2.3 Vapnik, Vladimir (1998). Statistical learning theory. Wiley. ISBN 9780471030034. https://books.google.com/books?id=GowoAQAAMAAJ&q=statistical+learning+theory. 
  3. 3.0 3.1 3.2 Wahba, Grace (1990). Spline models for observational data. SIAM. Bibcode1990smod.conf.....W. 
  4. Schölkopf, Bernhard; Smola, Alexander J. (2002). Learning with Kernels: Support Vector Machines, Regularization, Optimization, and Beyond. MIT Press. ISBN 9780262194754. 
  5. 5.0 5.1 Girosi, F.; Poggio, T. (1990). "Networks and the best approximation property". Biological Cybernetics (Springer) 63 (3): 169–176. doi:10.1007/bf00195855. https://dspace.mit.edu/bitstream/1721.1/6017/2/AIM-1164.pdf. 
  6. Aronszajn, N (May 1950). "Theory of Reproducing Kernels". Transactions of the American Mathematical Society 68 (3): 337–404. doi:10.2307/1990404. 
  7. Schwartz, Laurent (1964). "Sous-espaces hilbertiens d'espaces vectoriels topologiques et noyaux associés (noyaux reproduisants)". Journal d'Analyse Mathématique (Springer) 13 (1): 115–256. doi:10.1007/bf02786620. 
  8. Cucker, Felipe; Smale, Steve (October 5, 2001). "On the mathematical foundations of learning". Bulletin of the American Mathematical Society 39 (1): 1–49. doi:10.1090/s0273-0979-01-00923-5. 
  9. Kimeldorf, George S.; Wahba, Grace (1970). "A correspondence between Bayesian estimation on stochastic processes and smoothing by splines". The Annals of Mathematical Statistics 41 (2): 495–502. doi:10.1214/aoms/1177697089. 
  10. Schölkopf, Bernhard; Herbrich, Ralf; Smola, Alex J. (2001). "A Generalized Representer Theorem". Computational Learning Theory. Lecture Notes in Computer Science. 2111/2001. pp. 416–426. doi:10.1007/3-540-44581-1_27. ISBN 978-3-540-42343-0. 
  11. De Vito, Ernesto; Rosasco, Lorenzo; Caponnetto, Andrea; Piana, Michele; Verri, Alessandro (October 2004). "Some Properties of Regularized Kernel Methods". Journal of Machine Learning Research 5: 1363–1390. 
  12. 12.0 12.1 Rasmussen, Carl Edward; Williams, Christopher K. I. (2006). Gaussian Processes for Machine Learning. The MIT Press. ISBN 0-262-18253-X. http://www.gaussianprocess.org/gpml/. 
  13. Huang, Yunfei. (2019). "Traction force microscopy with optimized regularization and automated Bayesian parameter selection for comparing cells". Scientific Reports 9 (1): 537. doi:10.1038/s41598-018-36896-x. PMID 30679578. Bibcode2019NatSR...9..539H.