Sitemap
Analytics Vidhya

Analytics Vidhya is a community of Generative AI and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

Machine Learning: Support Vector Regression

--

We are about to discuss SVR(Support Vector Regression). So, let’s discuss what regression is actually? In statistical modelling, regression analysis is a set of statistical processes for estimating the relationships between a dependent variable (often called the ‘outcome variable’) and one or more independent variable (often called ‘predictors’, ‘covariates’, or ‘features’). The regression problem is a generalization of the classification problem, in which the model returns a continuous-valued output, as opposed to an output from a finite set. In other words, a regression model estimates a continuous-valued multivariate function.

Support Vector Machines:

As discussed above Regression problem is a generalization of the Classification problem. So, let’s throw some light on SVMs(Support Vector Machines) which is a classification algorithm which solves Binary Classification problem by convex optimization problems. The optimization problem deals with finding the maximum margin separating the hyperplane, while correctly classifying as many training points as possible. SVMs represents the hyperplane and support vectors. The scattered solution and good generalization of the SVM lend themselves to adaptation to regression problems.

Support Vector Machines. Source: Google Images.

Support Vector Regression:

SVR(Support Vector Regression) is less popular than SVM(Support Vector Machine). But, SVR has been proved to be an effective tool in real value function estimation. As a Supervised Learning approach SVR trains using a symmetrical loss function, which equally penalizes high and low misestimates.

As in classification, SVR is characterized by the use of Kernels, Sparse Solution, VC Control of the Margin and Number of Support Vectors.

SVM generalization to SVR is accomplished by introducing an Ɛ-insensitive region around the function, called the Ɛ-tube. This tube reformulates the optimization problem to find the tube that best approximates the continuous-valued function. The tube tries to balance model complexity and prediction error. To be more specific about creation of tube, SVR is formulated as an optimization problem by first defining a convex Ɛ-insensitive loss function to be minimized and finding the flattest tube that contains most of the training instances. The hyperplane is represented in terms of support vectors, which are training samples that lie outside the boundary of the tube. As in SVM, the support vectors in SVR are the most influential instances that affect the shape of the tube, and the training and test data are assumed to be independent and identically distributed.

Support Vector Regression. Source : Google Images.

SVR: Mathematical and Graphical Representation:

SVR problem formulation is often best derived from a geometrical perspective. Dealing with two types of Data:

One Dimensional Data: Mathematical Implementation of continuous-valued function being approximated can be written as in Equation below-

Get Gaurav Parihar’s stories in your inbox

Join Medium for free to get updates from this writer.

Equation representing One-dimensional formulation.
Press enter or click to view image in full size
One- Dimensional Linear SVR. Source: Google Images.

SVR formulates this function approximation problem as an optimization problem that attempts to find the narrowest tube centered around the surface, while minimizing the prediction error that is, the distance between the predicted and the desired outputs. The former condition produces the objective function in Equation, where ||w|| is the magnitude of the normal vector to the surface that is being approximated:

Formula to minimize the distance.

Multidimensional Data: We augment x by one and include b in the w vector to simply the mathematical notation, and obtain the multivariate regression in Equation below-

Equation representing Multidimensional formulation.

Here, M is the order of the polynomial used to approximate a function. As the magnitude of the vector w increases, a greater number of wi are nonzero, resulting in higher-order solutions. The horizontal line is a 0th-order polynomial solution and has a very large deviation from the desired outputs, and thus, a large error. The linear function, a 1st-order polynomial, produces better approximations for a portion of the data but still underfits the training data. The 6th-order solution produces the best tradeoff between function flatness and prediction error. The highest-order solution has zero error but a high complexity and will most likely overfit the solution on yet to be seen data. The magnitude of w acts as a regularizing term and provides optimization problem control over the flatness of the solution.

Press enter or click to view image in full size
Solution with Various Orders. Sources: Google Images.

Loss Functions: If e is decreased, the boundary of the tube is shifted inward. Therefore, more data points are around the boundary, which indicates more support vectors. Similarly, increasing Ɛ will result in fewer points around the boundary. Because it is less sensitive to noisy inputs, the e-insensitive region makes the model more robust. Several loss functions can be adopted, including the linear, quadratic, and Huber Ɛ.

Press enter or click to view image in full size
Loss Functions: a) Linear b)quadratic and c) Huber. Sources: Google Images.

Asymmetrical Loss Functions: Adopting a soft-margin approach similar to that employed in SVM, slack variables Ɛ, Ɛ* can be added to guard against outliers. These variables determine how many points can be tolerated outside the tube. C is a regularization — thus, a tuneable parameter that gives more weight to minimizing the flatness, or the error, for this multiobjective optimization problem.

Optimization Formula.
Press enter or click to view image in full size
Support Vector Regression. Source: Google Images.

Conclusion: The main advantage of SVR is that it’s computational complexity does not depend on the dimension of the input space. Additionally, it has excellent generalization capability with high prediction accuracy. The modified SVR can be applied to circumstances in which it is critically necessary to estimate or strictly limit underestimating a function.

“Thank You for your valuable time to read this blog on one of the algorithm of Machine Learning.”

--

--

Gaurav Parihar
Gaurav Parihar

Written by Gaurav Parihar

Machine Learning Enthusiast, Student of Computer Science, Jaypee Institute of Information Technology.

Analytics Vidhya
Analytics Vidhya

Published in Analytics Vidhya

Analytics Vidhya is a community of Generative AI and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com