Differentiate between Support Vector Machine and Logistic Regression
It is a classification model which is used to predict the odds in favour of a particular event. The odds ratio represents the positive event which we want to predict, for example, how likely a sample has breast cancer/ how likely is it for an individual to become diabetic in future. It used the sigmoid function to convert an input value between 0 and 1.
The basic idea of logistic regression is to adapt linear regression so that it estimates the probability a new entry falls in a class. The linear decision boundary is simply a consequence of the structure of the regression function and the use of a threshold in the function to classify. Logistic Regression tries to maximize the conditional likelihood of the training data, it is highly prone to outliers. Standardization (as co-linearity checks) is also fundamental to make sure a features’ weights do not dominate over the others.
Support Vector Machine (SVM):
It is a very powerful classification algorithm to maximize the margin among class variables. This margin (support vector) represents the distance between the separating hyperplanes (decision boundary). The reason to have decision boundaries with large margin is to separate positive and negative hyperplanes with adjustable bias-variance proportion. The goal is to separate so that negative samples would fall under negative hyperplane and positive samples would fall under positive hyperplane. SVM is not as prone to outliers as it only cares about the points closest to the decision boundary. It changes its decision boundary depending on the placement of the new positive or negative events.
The decision boundary is much more important for Linear SVM’s – the whole goal is to place a linear boundary in a smart way. There isn’t a probabilistic interpretation of individual classifications, at least not in the original formulation.
Hence, key points are:
- SVM try to maximize the margin between the closest support vectors whereas logistic regression maximize the posterior class probability
- SVM is deterministic (but we can use Platts model for probability score) while LR is probabilistic.
- For the kernel space, SVM is faster
|S.No.||Logistic Regression||Support Vector Machine|
|1.||It is an algorithm used for solving classification problems.||It is a model used for both classification and regression.|
|2.||It is not used to find the best margin, instead, it can have different decision boundaries with different weights that are near the optimal point.||it tries to find the “best” margin (distance between the line and the support vectors) that separates the classes and thus reduces the risk of error on the data.|
|3.||It works with already identified identified independent variable.||It works well with unstructured and semi-structured data like text and images.|
|4.||It is based on statistical approach.||It is based on geometrical properties of the data.|
|5.||It is vulnerable to overfitting.||The risk of overfitting is less in SVM.|
|6.||Problems to apply logistic regression algorithm.|
1. Cancer Detection: It can be used to detect if a patient has cancer(1) or not(0)
2. Test Score: Predict if the student is passed(1) or not(0).
3. Marketing: Predict if a customer will purchase a product(1) or not(0).
|Problems that can be solved using SVM|
1. Image Classification
2. Recognizing handwriting
3. Cancer Detection