Bayesian interpretation of kernel regularization

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

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

[edit | edit source]

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

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

[edit | edit source]

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

[edit | edit source]

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,βˆ€ fβˆˆβ„‹k,

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

β€–fβ€–k2=βˆ‘i,jk(𝐱i,𝐱j)cicj

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

The regularized functional

[edit | edit source]

The estimator is derived as the minimizer of the regularized functional

where fβˆˆβ„‹k 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

[edit | edit source]

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,

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

β€–fβ€–k2=⟨f,f⟩k,=βŸ¨βˆ‘i=1Ncik(𝐱i,β‹…),βˆ‘j=1Ncjk(𝐱j,β‹…)⟩k,=βˆ‘i=1Nβˆ‘j=1Ncicj⟨k(𝐱i,β‹…),k(𝐱j,β‹…)⟩k,=βˆ‘i=1Nβˆ‘j=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

[edit | edit source]

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

[edit | edit source]

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

[edit | edit source]

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

[edit | edit source]

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

[edit | edit source]

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Οƒ2β€–f𝐰(𝐗)βˆ’π˜β€–2),

where f𝐰(𝐗)=(⟨𝐰,Ξ¦(𝐱1)⟩,…,⟨𝐰,Ξ¦(𝐱n⟩). The resulting posterior distribution is then given by

P(f|𝐗,𝐘)∝exp(βˆ’1Οƒ2β€–f𝐰(𝐗)βˆ’π˜β€–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

[edit | edit source]

References

[edit | edit source]
  1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  2. ^ a b c d Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  3. ^ a b c Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  4. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  5. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  6. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  7. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  8. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  9. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  10. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  11. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  12. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  13. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).