Regularized least squares
Regularized least squares (RLS) is a family of methods for solving the least-squares problem while using regularization to further constrain the resulting solution. RLS is used for two main reasons. The first comes up when the number of variables in the linear system exceeds the number of observations. In such settings, the ordinary least-squares problem is ill-posed and is therefore impossible to fit because the associated optimization problem has infinitely many solutions. RLS allows the introduction of further constraints that uniquely determine the solution. The second reason for using RLS arises when the learned model suffers from poor generalization. RLS can be used in such cases to... Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.
Regularized least squares (RLS) is a family of methods for solving the least-squares problem while using regularization to further constrain the resulting solution. RLS is used for two main reasons. The first comes up when the number of variables in the linear system exceeds the number of observations. In such settings, the ordinary least-squares problem is ill-posed and is therefore impossible to fit because the associated optimization problem has infinitely many solutions. RLS allows the introduction of further constraints that uniquely determine the solution. The second reason for using RLS arises when the learned model suffers from poor generalization. RLS can be used in such cases to improve the generalizability of the model by constraining it at training time. This constraint can either force the solution to be "sparse" in some way or to reflect other prior knowledge about the problem such as information about correlations between features. A Bayesian understanding of this can be reached by showing that RLS methods are often equivalent to priors on the solution to the least-squares problem. Consider a learning setting given by a probabilistic space (X \times Y, \rho(X,Y)) , Y \in R . Let S = \{x_i,y_i\}_{i=1}^n denote a training set of n pairs i.i.d. with respect to the joint distribution \rho . Let V:Y \times R \to [0;\infty) be a loss function. Define F as the space of the functions such that expected risk: \varepsilon(f) = \int V(y,f(x)) \, d\rho(x,y) is well defined. The main goal is to minimize the expected risk: \inf_{f \in F}\varepsilon(f) Since the problem cannot be solved exactly there is a need to specify how to measure the quality of a solution. A good learning algorithm should provide an estimator with a small risk. As the joint distribution \rho is typically unknown, the empirical risk is taken. For regularized least squares the square loss function is introduced: \varepsilon(f) = \frac{1}{n}\sum_{i=1}^n V(y_i,f(x_i)) = \frac{1}{n}\sum_{i=1}^n(y_i-f(x_i))^2 However, if the functions are from a relatively unconstrained space, such as the set of square-integrable functions on X , this approach may overfit the training data, and lead to poor generalization. Thus, it should somehow constrain or penalize the complexity of the function f . In RLS, this is accomplished by choosing functions from a reproducing kernel Hilbert space (RKHS) \mathcal {H} , and adding a regularization term to the objective function, proportional to the norm of the function in \mathcal {H} : \inf_{f \in F}\varepsilon(f) + \lambda R(f), \lambda > 0 \langle K_x,f\rangle_{\mathcal{H}} = f(x), where K_x(z) = K(x,z) . The RKHS for a kernel K consists of the completion of the space of functions spanned by \left\{ K_x\mid x \in X\right\} : f(x) = \sum_{i=1}^n \alpha_i K_{x_i}(x),\, f\in\mathcal{H} , where all \alpha_i are real numbers. Some commonly used kernels include the linear kernel, inducing the space of linear functions: K(x,z) = x^\mathsf{T} z, the polynomial kernel, inducing the space of polynomial functions of order d : K(x,z) = \left(x^\mathsf{T} z + 1\right)^d, and the Gaussian kernel: K(x,z) = e^{-{\left\|x - z\right\|^2}/{\sigma^2}}. Note that for an arbitrary loss function V , this approach defines a general class of algorithms named Tikhonov regularization. For instance, using the hinge loss leads to the support vector machine algorithm, and using the epsilon-insensitive loss leads to support vector regression. === Arbitrary kernel=== The representer theorem guarantees that the solution can be written as: f(x) = \sum_{i=1}^n c_i K(x_i,x) for some c \in \mathbb R^n . The minimization problem can be expressed as: \min_{c \in\mathbb R^n}\frac{1}{n} \left\|Y - K c\right\|^2_{\mathbb R^n} + \lambda \left\|f\right\|^2_H, where, with some abuse of notation, the i,j entry of kernel matrix K (as opposed to kernel function K(\cdot, \cdot) ) is K(x_i, x_j) . For such a function, \begin{align} \left\|f\right\|^2_H &= \langle f,f \rangle_{H} \\[1ex] &= \left\langle \sum_{i=1}^n c_i K(x_i,\cdot), \sum_{j=1}^n c_j K(x_{j},\cdot) \right\rangle_H \\[1ex] &= \sum_{i=1}^n \sum_{j=1}^n c_i c_j \left\langle K(x_i,\cdot), K(x_j,\cdot) \right\rangle_H \\ &= \sum_{i=1}^n \sum_{j=1}^n c_i c_j K(x_i,x_j) \\ &= c^\mathsf{T} Kc, \end{align} The following minimization problem can be obtained: \min_{c \in\mathbb R^n} \frac{1}{n} \left\|Y - K c\right\|^2_{\mathbb R^n} + \lambda c^\mathsf{T} Kc. As the sum of convex functions is convex, the solution is unique and its minimum can be found by setting the gradient with respect to c to 0 : -\frac{1}{n} K \left(Y - Kc\right) + \lambda Kc = 0 \Rightarrow K\left(K+\lambda n I\right)c = K Y \Rightarrow c = \left(K+\lambda n I\right)^{-1}Y, where c \in\mathbb R^n. f(x_{*}) = \sum_{i=1}^n c_i K(x_i,x_{*}) = K(X,X_{*})^\mathsf{T} c For convenience a vector notation is introduced. Let X be an n\times d matrix, where the rows are input vectors, and Y a n\times 1 vector where the entries are corresponding outputs. In terms of vectors, the kernel matrix can be written as K = X X^\mathsf{T} . The learning function can be written as: f(x_{*}) = K_{x_{*}}c Here we define w = X^\mathsf{T} c, w \in \Reals^d . The objective function can be rewritten as: \begin{align} \frac{1}{n} \left\|Y - Kc\right\|^2_{\Reals^n} + \lambda c^\mathsf{T} Kc &= \frac{1}{n} \left\|y - X X^\mathsf{T} c\right\|^2_{\Reals^n} + \lambda c^\mathsf{T} X X^\mathsf{T} c \\[1ex] &= \frac{1}{n} \left\|y - X w\right\|^2_{\Reals^n} + \lambda \left\|w\right\|^2_{\mathbb R^d} \end{align} The first term is the objective function from ordinary least squares (OLS) regression, corresponding to the residual sum of squares. The second term is a regularization term, not present in OLS, which penalizes large w values. As a smooth finite dimensional problem is considered and it is possible to apply standard calculus tools. In order to minimize the objective function, the gradient is calculated with respect to w and set it to zero: X^\mathsf{T} X w - X^\mathsf{T} y + \lambda n w=0 w = \left( X^\mathsf{T} X+\lambda n I\right)^{-1} X^\mathsf{T} y This solution closely resembles that of standard linear regression, with an extra term \lambda I . If the assumptions of OLS regression hold, the solution w = \left( X^\mathsf{T} X\right)^{-1} X^\mathsf{T} y , with \lambda = 0 , is an unbiased estimator, and is the minimum-variance linear unbiased estimator, according to the Gauss–Markov theorem. The term \lambda n I therefore leads to a biased solution; however, it also tends to reduce variance. This is easy to see, as the covariance matrix of the w -values is proportional to \left( X^\mathsf{T} X + \lambda n I\right)^{-1} , and therefore large values of \lambda will lead to lower variance. Therefore, manipulating \lambda corresponds to trading-off bias and variance. For problems with high-variance w estimates, such as cases with relatively small n or with correlated regressors, the optimal prediction accuracy may be obtained by using a nonzero \lambda , and thus introducing some bias to reduce variance. Furthermore, it is not uncommon in machine learning to have cases where n , in which case X^\mathsf{T} X is rank-deficient, and a nonzero \lambda is necessary to compute \left( X^\mathsf{T} X + \lambda n I\right)^{-1} . == Feature maps and Mercer's theorem== In this section it will be shown how to extend RLS to any kind of reproducing kernel K. Instead of linear kernel a feature map is considered \Phi: X \to F for some Hilbert space F , called the feature space. In this case the kernel is defined as: The matrix X is now replaced by the new data matrix \Phi , where \Phi_{ij} = \varphi_j(x_i) , or the j -th component of the \varphi(x_i) . K(x,x') = \langle \Phi(x), \Phi(x') \rangle_F. It means that for a given training set K = \Phi \Phi^\mathsf{T} . Thus, the objective function can be written as \min_{c \in \mathbb R^n} \left\|Y - \Phi \Phi^\mathsf{T} c \right\|^2_{\mathbb R^n} + \lambda c^\mathsf{T} \Phi \Phi^\mathsf{T} c. This approach is known as the kernel trick. This technique can significantly simplify the computational operations. If F is high dimensional, computing \varphi(x_i) may be rather intensive. If the explicit form of the kernel function is known, we just need to compute and store the n\times n kernel matrix K . In fact, the Hilbert space F need not be isomorphic to \mathbb{R}^m , and can be infinite dimensional. This follows from Mercer's theorem, which states that a continuous, symmetric, positive definite kernel function can be expressed as K(x,z) = \sum_{i=1}^\infty \sigma_i e_i(x) e_i(z) where e_i(x) form an orthonormal basis for \ell^2(X) , and \sigma_i \in\mathbb{R} . If feature maps is defined \varphi(x) with components \varphi_i(x) = \sqrt{\sigma_i}e_i(x) , it follows that K(x,z) = \langle\varphi(x),\varphi(z)\rangle . This demonstrates that any kernel can be associated with a feature map, and that RLS generally consists of linear RLS performed in some possibly higher-dimensional feature space. While Mercer's theorem shows how one feature map that can be associated with a kernel, in fact multiple feature maps can be associated with a given reproducing kernel. For instance, the map \varphi(x)=K_x satisfies the property K(x,z) = \langle\varphi(x), \varphi(z) \rangle for an arbitrary reproducing kernel. ==Bayesian interpretation== Least squares can be viewed as a likelihood maximization under an assumption of normally distributed residuals. This is because the exponent of the Gaussian distribution is quadratic in the data, and so is the least-squares objective function. In this framework, the regularization terms of RLS can be understood to be encoding priors on w . For instance, Tikhonov regularization corresponds to a normally distributed prior on w that is centered at 0. To see this, first note that the OLS objective is proportional to the log-likelihood function when each sampled y^i is normally distributed around w^\mathsf{T} \cdot x^i . Then observe that a normal prior on w centered at 0 has a log-probability of the form \log P(w) = q - \alpha \sum_{j=1}^d w_j^2 where q and \alpha are constants that depend on the variance of the prior and are independent of w . Thus, minimizing the logarithm of the likelihood times the prior is equivalent to minimizing the sum of the OLS loss function and the ridge regression regularization term. This gives a more intuitive interpretation for why Tikhonov regularization leads to a unique solution to the least-squares problem: there are infinitely many vectors w satisfying the constraints obtained from the data, but since we come to the problem with a prior belief that w is normally distributed around the origin, we will end up choosing a solution with this constraint in mind. Other regularization methods correspond to different priors. See the list below for more details. ==Specific methods== The following is a list of possible choices of the regularization function R(\cdot) , along with the name for each one, the corresponding prior if there is a simple one, and ways for computing the solution to the resulting optimization problem. R(w) = \sum_{j=1}^d w_j^2 and the solution is found as \hat{w} = \text{argmin}_{w \in \mathbb{R}^d} \frac{1}{n} \left\|Y - X w \right\|^2_2+\lambda \sum_{j=1}^d \left|w_j\right|^2 The most common names for this are called Tikhonov regularization and ridge regression. It admits a closed-form solution for w : \hat{w} = \left(\frac{1}{n} X^\mathsf{T} X + \lambda I\right)^{-1} \frac{1}{n}X^\mathsf{T} Y = \left(X^\mathsf{T} X + n\lambda I\right)^{-1} X^\mathsf{T} Y The name ridge regression alludes to the fact that the \lambda I term adds positive entries along the diagonal "ridge" of the sample covariance matrix \frac{1}{n}X^\mathsf{T} X . When \lambda=0 , i.e., in the case of ordinary least squares, the condition that d > n causes the sample covariance matrix \frac{1}{n}X^\mathsf{T} X to not have full rank and so it cannot be inverted to yield a unique solution. This is why there can be an infinitude of solutions to the ordinary least squares problem when d > n . However, when \lambda > 0 , i.e., when ridge regression is used, the addition of \lambda I to the sample covariance matrix ensures that all of its eigenvalues will be strictly greater than 0. In other words, it becomes invertible, and the solution is then unique. Compared to ordinary least squares, ridge regression is not unbiased. It accepts bias to reduce variance and the mean square error. ====Simplifications and automatic regularization==== If we want to find \hat{w} for different values of the regularization coefficient \lambda (which we denote \hat{w}(\lambda) ) we may use the eigenvalue decomposition of the covariance matrix \frac{1}{n} X^\mathsf{T} X = Q \text{diag}(\alpha_1,\ldots,\alpha_d)Q^\mathsf{T} where columns of Q\in\mathbb{R}^{d\times d} are the eigenvectors of \frac{1}{n} X^\mathsf{T} X and \alpha_1,\ldots, \alpha_d - its d eigenvalues. The solution in then given by \hat{w}(\lambda) = Q \text{diag}^{-1}(\alpha_1+\lambda,\ldots,\alpha_d+\lambda)Z where Z = \frac{1}{n}Q^\mathsf{T}X^\mathsf{T} Y=[Z_1,\ldots,Z_d]^\mathsf{T}. Using the above results, the algorithm for finding a maximum likelihood estimate of \lambda may be defined as follows: \lambda \leftarrow \frac{1}{n} \sum_{i=1}^d \frac{\alpha_i}{\alpha_i+\lambda} \left[ \frac{\frac{1}{n}\|Y-X\hat{w}(\lambda)\|^2}{\|\hat{w}(\lambda)\|^2} +\lambda \right]. This algorithm, for automatic (as opposed to heuristic) regularization, is obtained as a fixed point solution in the maximum likelihood estimation of the parameters. Although the guarantees of convergence are not provided, the examples indicate that a satisfactory solution may be obtained after a couple of iterations. The eigenvalue decomposition simplifies derivation of the algorithm and also simplifies the calculations: \|\hat{w}(\lambda)\|^2 = \sum_{i=1}^d \frac {\lambda_2} \sqrt{2(1-\rho_{ij})}, where \rho_{ij} = x_i^\mathsf{T} x_j . If x_i and x_j are highly correlated ( \rho_{ij} \to 1 ), the weight vectors are very close. In the case of negatively correlated samples ( \rho_{ij} \to -1 ) the samples -x_j can be taken. To summarize, for highly correlated variables the weight vectors tend to be equal up to a sign in the case of negative correlated variables. ==See also== Least squares Regularization in mathematics. Generalization error, one of the reasons regularization is used. Tikhonov regularization Lasso regression Elastic net regularization :Least-angle regression
Cite this
"Regularized least squares". 1789961973. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1375973784 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy