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).